[Stackless] Stackless for Python 2.5b2 / help required

Jeff Senn senn at maya.com
Fri Aug 4 15:23:59 CEST 2006



Richard Tew wrote:
> I was at approximately the same place as you before I gave up
> when I last spent time on this.   However, I didn't have a clue
> where the stack might be going wrong, and your note about
> _value and _noval make things a little more approachable
> now.

Ok - more data. I'm beginning to suspect it has something to do
with the generator destruction.  There is a path that
calls back into PyEval_EvalFrame_slp when the last reference to
a generator is dropped. (in gen_iternext_callback the DECREF
of 'gen' calls gen_close... eventually leading to the execution
of a frame that uses the _noval alternative)

> The only problem I would be able to spot is bad porting on my
> part which is more common than I would like.  But.. I have
> gone over the diffs several times and I don't see any badly
> applied Stackless changes which might relate to the problem
> we are seeing here :(

Oh! Note that in 2.4 this whole example would never have occurred
because you wouldn't have been able to embed a yield into the
try/except/finally ... so maybe that is a clue as well...

-Jas

def gen():
     yield

def foo(a):
     try: a.next()
     except: pass

def test(a):
     a.next()
     try: yield
     except: pass # comment out this line = no crash - weird!
     finally:
	foo(a) # unrolling this func call = no crash
y=test(gen())
y.next()

# no crash yet because we still have a ref to y
# un-comment next line to crash before the loop
#y=None

# if we don't exit it won't crash
while 1: pass
# hit C-c and it will!

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



More information about the Stackless mailing list