sm...@gmx.net wrote:
Now, the problem is, Python appears to read-access the deallocated memory still after tp_dealloc.

It's not clear exactly what you mean by "after tp_dealloc".
The usual pattern is for a type's tp_dealloc method to call
the base type's tp_dealloc, which can make further references
to the object's memory. At the end of the tp_dealloc chain,
tp_free gets called, which is what actually deallocates the
memory.

I would say your tp_dealloc shouldn't be modifying anything
in the object struct that your corresponding tp_alloc method
didn't set up, because code further along the tp_dealloc
chain may rely on it. That includes fields in the object
header.

--
Greg
_______________________________________________
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