Searching for the meaning of gcmodule.c assert:`gc->gc. gc_refs == GC_REACHABLE'

David Helgason david at uti.is
Thu Nov 13 17:26:35 EST 2003


I am embedding python on Mac OSX (jaguar + panther) using 
boost::python. It works like a treat, but when using a python framework 
with asserts compiled in, I sometimes get an assert from gcmodule.c, 
line 215 when compiling a script.
	
	Modules/gcmodule.c:215: failed asserrtion `gc->gc.gc_refs == 
GC_REACHABLE'

This is maybe the third script I compile, so the python environment 
should still be very clean.

I tried reading the code in gcmodule.c but don't understand what the 
assert is warning me about or what is wrong here. Since I'm embedding 
python I suspect that I'm doing something wrong with reference 
counting, but in a ref-counted world that would either lead to leaks or 
crashes. Can wrong ref-counting confuse the garbage collector so badly 
that it asserts?

Since I don't really need the garbage collector I've tried disabling it 
from python, and that fixes the problem. Only I'm worried that I've 
just managed to hide a bug, not remove it.

I would be infinitly thankful if anyone could point me in a general 
direction as to what the problem might be.


David Helgason
-- 
Over the Edge Entertainments






More information about the Python-list mailing list