[Stackless-checkins] r53567 - in stackless/tags/python-2.5/Stackless: core/stacklesseval.c unittests/test_generator.py
richard.tew
python-checkins at python.org
Thu Jan 25 22:41:53 CET 2007
Author: richard.tew
Date: Thu Jan 25 22:41:52 2007
New Revision: 53567
Added:
stackless/tags/python-2.5/Stackless/unittests/test_generator.py
- copied unchanged from r53566, stackless/branches/release25-maint/Stackless/unittests/test_generator.py
Modified:
stackless/tags/python-2.5/Stackless/core/stacklesseval.c
Log:
Ported the fix to the bug Jeff Senn's generator leakage test reproduced from the release25-maint branch (r53557, r53566).
http://www.stackless.com/pipermail/stackless/2006-December/002144.html
Modified: stackless/tags/python-2.5/Stackless/core/stacklesseval.c
==============================================================================
--- stackless/tags/python-2.5/Stackless/core/stacklesseval.c (original)
+++ stackless/tags/python-2.5/Stackless/core/stacklesseval.c Thu Jan 25 22:41:52 2007
@@ -542,6 +542,7 @@
if (result == Py_None && f->f_stacktop == NULL) {
Py_DECREF(result);
result = NULL;
+ /* Set exception if not called by gen_iternext() */
if (arg)
PyErr_SetNone(PyExc_StopIteration);
/* Stackless extra handling */
@@ -553,13 +554,18 @@
}
}
+ /* We hold references to things in the cframe, if we release it
+ before we clear the references, they get incorrectly and
+ prematurely free. */
+ cf->ob1 = NULL;
+ cf->ob2 = NULL;
+
if (!result || f->f_stacktop == NULL) {
/* generator can't be rerun, so release the frame */
+ Py_DECREF(f);
gen->gi_frame = NULL;
}
- cf->ob1 = NULL;
- cf->ob2 = NULL;
Py_DECREF(gen);
Py_XDECREF(arg);
return result;
_______________________________________________
Stackless-checkins mailing list
Stackless-checkins at stackless.com
http://www.stackless.com/mailman/listinfo/stackless-checkins
More information about the Stackless-checkins
mailing list