Greg Ewing, 29.11.2009 12:24: > Stefan Behnel wrote: > >> cdef unicode u = "abcdefg" >> cdef char* s = u >> u = None >> print s >> >> Now, where's the reference to the string buffer now? > > That's the way Pyrex has always handled str -> char* conversions, > and I assume the way Cython still handles bytes -> char*. You > have to keep a reference to the Python object around for as > long as you need the char*.
Fine. That wasn't my point, though. The thing is that the above requires *two* Python objects to exist, not just the one that the user controls the reference of. Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
