[Stackless] Stackless for Python 2.5b2 / help required
senn at maya.com
Wed Aug 2 15:03:50 CEST 2006
On Jul 21, 2006, at 9:04 AM, Richard Tew wrote:
>> I'll try to give it some cycles after next week.
> That'd be great :)
So (after including your fix for my example) I go
back to the test_contextlib.py check and indeed it crashes.
Something seems to be getting messed up on the VM valuestack.
The actual problem is that we get to the very end of the
test that is failing (and in (contextlib.py:def nested(...)" the last
the END_FINALLY opcode tries to
POP from the stack when the stack is empty. (It's trying
to pop the "why" code - which I'm guessing should be "None"
in this case). **
So something is obviously wrong earlier (maybe in the exception
cleanup during a previous 'except' clause?)
However it's hard for me to debug since LLTRACE doesn't seem
to work with stackless either (I haven't looked too far into that
yet... it seems like a rat hole...)
**Note: the resulting problem is actually much worse. Since
the Python VM (presumably for performance reasons) does not do
bounds checking when POPing the valuestack. So unless you apply
the patch below to ceval.c (or a similar one), what
*actually* happens is that the stack starts madly popping through
itself into random bits of memory at a later (and more confusing)
point in time.
-#define BASIC_POP() (*--stack_pointer)
+#define BASIC_POP() (assert(STACK_LEVEL() >= 1), ((STACK_LEVEL()
== 0) ? 0 : (*--stack_pointer)))
I hope this helps - maybe you can guess where the problem is?
Stackless mailing list
Stackless at stackless.com
More information about the Stackless