Refcount problem in ceval.c

Berthold Höllmann berthold at
Thu Sep 11 09:11:59 CEST 2008

Christian Heimes <lists at> writes:

> Berthold Höllmann wrote:
>> Is there any "common" reason to for such a strange object on the command
>> stack, or is it more likely that any of my extension modules is causing
>> havoc?
> It's very likely that your extension has a reference counting bug. It
> looks like you are either missing a Py_INCREF or you have a Py_DECREF
> too much. Newly freed memory is filled with 0xDB (see
> Objects/obmalloc.c DEADBYTE).

I was suspecting this, that's why I build the debugging version of
Python. I hoped I would get the error message somewhere near the code
causing the error, but I seems i have to continue the search.

> Wild guess: Are you using PyModule_AddObject with a PyTypeObject w/o
> Py_INCREF()ing the type object first?

That would have been easy :-) I have only one occurrence of
PyModule_AddObject, and its PyTypeObject is Py_INCREF()ed

                            __   Address:
                         G /  \ L Germanischer Lloyd
phone: +49-40-36149-7374 -+----+- Vorsetzen 35       P.O.Box 111606
fax  : +49-40-36149-7320   \__/   D-20459 Hamburg    D-20416 Hamburg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
URL: <>

More information about the Python-list mailing list