[Stackless] FW: bug in latest release

Christian Tismer tismer at stackless.com
Tue May 16 15:07:07 CEST 2006


Grant Olson wrote:

> I'm running python 2.4.3 on Windows XP.  The following code hangs when I try
> it in stackless.  It properly throws recursionLimitException with stock
> python 2.4.3:
> 
> def ping():
>     print "PING"
>     pong()
> 
> def pong():
>     print "PONG"
>     ping()
> 
> 
> ping()

This is a bug in the latest Stackless port.
Richard, can you please correct this? I still don't have access.

In Python 2.3.3, we had in ceval.c at line 741:
	/* push frame */
	if (++tstate->recursion_depth > recursion_limit) {
		--tstate->recursion_depth;
		PyErr_SetString(PyExc_RuntimeError,
				"maximum recursion depth exceeded");
		tstate->frame = f->f_back;
		return NULL;
	}

Python 2.4.3 seems to differ from that. line 703:
#ifdef STACKLESS
	if (CSTACK_SAVE_NOW(tstate, f))
		return slp_eval_frame_newstack(f, retval);
#endif /* STACKLESS */

	/* push frame */
	if (Py_EnterRecursiveCall(""))
		return NULL;

	tstate->frame = f;

This macro calls _Py_CheckRecursiveCall, which does not explicitly
adjust tstate->frame.
So my proposal is

#ifdef STACKLESS
	if (CSTACK_SAVE_NOW(tstate, f))
		return slp_eval_frame_newstack(f, retval);

	/* push frame */
	if (Py_EnterRecursiveCall("")) {
		tstate->frame = f->f_back;
		return NULL;
	}
#else

	/* push frame */
	if (Py_EnterRecursiveCall(""))
		return NULL;
#endif /* STACKLESS */

-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
tismerysoft GmbH             :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9A     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 802 86 56  mobile +49 173 24 18 776  fax +49 30 80 90 57 05
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/

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



More information about the Stackless mailing list