I noticed something (in 2.5) yesterday, which may be a feature, but is more 
likely a bug.
In tokenizer.c, tok->encoding is allocated using PyMem_MALLOC().
However, this then gets handed to a node->r_str in parsetok.c, and then 
released in node.c using PyObject_Free().

Now, by coincidence, PyObject_Free() will default to free() for objects that it 
doesn't recognize, so this works.  But is this documented behavior?  The reason 
I ran into this was that I had redirect the PyMem_* API to a different 
allocator, but left the PyObject_* one alone.

My feeling Is that these two APIs shouldn't be interchangeable.  Especially 
since you can't hand a PyObject_Malloc'd object to PyMem_Free() so the inverse 
shouldn't be expected to work.

Any thoughts?

Kristján
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to