Andy,
> The TString class solves this problem by providing a constructor taking a
> char* and a size.
as does the Python C-API string manipulation functions. Problem is that in the dictionary, there is nothing more on the 'char*' return that indicates it is a byte-buffer rather than a string (which is by far the more common case), and of course a length can not be had.
What is the use case here? The reason I'm asking is that the pickling of ROOT objects works by serializing them into a TBufferFile, and then stuffing its Buffer() result into a python string, using the length.
> Is there some wrapper function like that in PyROOT that
> I've overlooked, or is there some other way to get handle arrays/strings
> containing nulls?
No, nothing of the kind exists (other than the pickling described above), so you'd have to add such a wrapper yourself, using something like:
PyString_FromStringAndSize( buff->Buffer(), buff->Length() );
Best regards,
Wim
-- WLavrijsen_at_lbl.gov -- +1 (510) 486 6411 -- www.lavrijsen.netReceived on Wed Nov 23 2011 - 23:55:08 CET
This archive was generated by hypermail 2.2.0 : Fri Nov 25 2011 - 23:50:01 CET