[Stackless] 2.5 porting issue

Jeff Senn senn at maya.com
Wed Jul 5 15:09:45 CEST 2006



Richard wrote:
> I am having trouble tracking down a bug in Stackless for
> Python 2.5b1.  If anyone has any experience in debugging the
> Python virtual machine I would appreciate the help.  In fact
...

> It crashes within a generator expression because the virtual
> machine goes to discard a local in the current frame
> and finds there are no references to it.. dereferencing
> Py_None when no-one holds a reference to it is a fatal error.
> 
> Perhaps I need to be adding a reference to Py_None somewhere.

If you get to the point of dereferencing Py_None down to zero
references it's usually way too late... The None value is usually
shared and has many references.  When this happens to me I start
looking for some function that is returning Py_None w/o adding a
reference (seems to be the most common mistake.) It's sometimes
hard to find because by the time
None gets down to zero you're exhausting other people's references
and may be no where "near" the problem...

Usually the problem is in a loop when it's happening (if it's
vaguely local to some bit of python code) It might help to
put a breakpoint in gdb and find the None value and watch the
refcount on it at a few places to try to get a feel for where
the problem might be.

-Jas

P.S. I might be able to offer some more specific help later
this week...




_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list