This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Extracting strings from Python beyond the terminating NULL


Phil Muldoon wrote:
And the code in question uses that. So even though we dutifully preserve the embedded null, when the call to Python is made to extract the string, it is terminated on the first null. I'm hoping I missed a length based api call that some python hacker can point me too. PyString_Size(string) actually returns the correct (non null terminated) length btw.

And it only took me to write this email to to figure out that:

PyString_AsStringAndSize(object, &result, &size);


Will fetch the whole string, and report the size as well.


(In the existing code the xstrdup call threw me)

Thanks for reading anyway!

Regards

Phil


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]