[Zope3-dev] python assert failed with Zope3 persistence
Tim Peters
tim@zope.com
Wed, 10 Jul 2002 19:33:17 -0400
[Jeremy Hylton]
> If I import Persistence from Zope3 using a debug build of CVS Python,
> I get a failed assert in the garbage collector:
>
> python: ../Modules/gcmodule.c:210: visit_decref: Assertion
> `gc->gc.gc_refs != 0' failed.
> Aborted
>
> I don't really know what would cause this to fail or what I should
> look for in my code. Any ideas?
Fascinating! That's a very new assert (about a week old). The comment
should help:
assert(gc->gc.gc_refs != 0); /* else refcount was too small */
That is, for whatever object gc is pointing at, it should mean that there
were more pointers to it in the current generation alone than
FROM_GC(gc)->ob_refcnt (which is the starting value of gc->gc.gc_refs) said
there were. So the most likely cause is a missing Py_INCREF. Wild stores
are also possible. It's also possible that gc got moved into an older
generation without having its gc_refs value set to GC_REACHABLE (a negative
number), but that shouldn't be possible. Get in a debugger next and learn
something about the object pointed at?