rich comparison fscks up reference count?
gerhardhaering at googlemail.com
Mon Apr 12 16:27:05 CEST 2010
Maybe somebody can enlighten me here. I can't figure out why doing a
rich comparison on my object decreases the total reference count by 1.
Linked is the minimal test case with a C exension that compiles under
both Python 2.6 and 3.1. No external dependencies, except a DEBUG
build of Python to see the effect (Py_REF_DEBUG defined).
Builtin types like list, dict, etc. don't seem to have the same
I've also run the test a few thousand times; then the total refcount
is like -50000, but Python does not crash. Also if I print all objects
and their respective refcounts using the gc module, none of them seems
to have a negative refcount, but the total refcount is still way
negative. How could that be?
More information about the Python-list