[Python-Dev] tp_dealloc

Nick Coghlan ncoghlan at gmail.com
Wed Jun 2 14:33:19 CEST 2010


On 01/06/10 22:21, smarv at gmx.net wrote:
>> This said, there may be a bug somewhere, but what do you want us to look
>> at?
>> Do you have a case that we could reproduce and investigate?
>>
>> --
>> Amaury Forgeot d'Arc
>
> Thank you, I'm not a C-Developer,
> but still I have one more detail:
>
> I call py_decRef( pyObj) of dll (version 3.1.1),
> ( which calls tp_dealloc, which calls my freeMem() method))
> No problem is reported here.

As Amaury has pointed out, there are a number of ways this could be bug 
in your extension module, or some other CPython extension you are using 
(most obviously, a Py_DECREF without a corresponding Py_INCREF, but 
there are probably other more exotic ways to manage it).

If you corrupt the reference count for a module global variable with an 
extra Py_DECREF call, then you may get an access violation at 
interpreter shutdown (i.e. in response to a Py_Finalize call) as the 
destruction of the module attempts to decrement the reference count of 
an object that was incorrectly deleted while it was still referenced.

Since the symptoms you have described so far *exactly* match the 
expected symptoms of a reference counting bug which may not have 
anything whatsoever to do with the interpreter core or the standard 
library, you're going to need a much better defined test case (written 
in C or Python) to convince us that our code is the problem.

Regards,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------


More information about the Python-Dev mailing list