[Python-3000] Can a Python object move in memory?

"Martin v. Löwis" martin at v.loewis.de
Wed Aug 29 20:12:46 CEST 2007


>> Because the pointer may change? There is a (silent) promise that for
>> a given PyUnicodeObject, the Py_UNICODE* will never change.
> 
> Right, it's the pointer changing that I'm worried about.  Should I not
> bother with changing my code, then?

Correct. If you think this promise should be given explicitly in the
documentation, feel free to propose a documentation patch.

Of course, if the underlying (rather, encapsulating) PyObject goes
away, the pointer becomes invalid. IIUC, you have some guarantee
that the unicode object will stay available all the time.

Regards,
Martin



More information about the Python-3000 mailing list