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

Eric Smith eric+python-dev at trueblade.com
Wed Aug 29 19:34:37 CEST 2007


As part of the PEP 3101 stuff, I have an iterator that I've written in 
C.  It has a PyUnicodeObject* in it, which holds the string I'm parsing. 
  I do some parsing, return a result, do some more parsing on the next 
call, etc.  This code is callable from Python code.

I keep Py_UNICODE* pointers into this PyUnicodeObject in my iterator 
object, and I access these pointers on subsequent calls to my next() 
method.  Is this an error?  The more I think about it the more convinced 
I am it's an error.

I can change it to use indexes instead of pointers pretty easily, if I 
need to.


More information about the Python-3000 mailing list