John Ralls <[email protected]> writes: >> PS. Another solution would be to force byte string only arguments for >> python 3 using a SWIG define SWIG_PYTHON_STRICT_BYTE_CHAR. >> >> This would require a major re-write of the gnucash_core.py to perform the >> unicode<->byte transformations. > > ISTM it would be better to fix qof_query. It shouldn't be assuming > that just because it has typedeffed const char* to "QofIdTypeConst" > that it will necessarily get a statically allocated char* that is safe > to keep. There's absolutely nothing preventing it from being a stack > or heap object (stack is more likely in C, as in > QofIdTypeConst type = "book"; > qof_query_search_for(query, type); > ) that will cause the same crash.
I disagree -- the API specification is clear that it will store the pointer, so callers need to know this. When it moves to C++ you can just use std::string. :) > There are probably other cases where someone has made the same bad > assumption and stored an unduplicated char*, though I hope none quite > so egregious. > > Please file a bug: https://wiki.gnucash.org/wiki/Bugzilla > > Regards, > John Ralls -derek -- Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory Member, MIT Student Information Processing Board (SIPB) URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH [email protected] PGP key available _______________________________________________ gnucash-devel mailing list [email protected] https://lists.gnucash.org/mailman/listinfo/gnucash-devel
