[py-svn] r34242 - py/dist/py/c-extension/greenlet
arigo at codespeak.net
arigo at codespeak.net
Sun Nov 5 16:05:00 CET 2006
Author: arigo
Date: Sun Nov 5 16:04:58 2006
New Revision: 34242
Modified:
py/dist/py/c-extension/greenlet/greenlet.c
Log:
(tismer, arigo)
A greenlet bug, as shown by an assert. On Linux the bug silently does
nothing, but on Windows we get a crash.
Modified: py/dist/py/c-extension/greenlet/greenlet.c
==============================================================================
--- py/dist/py/c-extension/greenlet/greenlet.c (original)
+++ py/dist/py/c-extension/greenlet/greenlet.c Sun Nov 5 16:04:58 2006
@@ -177,6 +177,7 @@
*/
long sz1 = g->stack_saved;
long sz2 = stop - g->stack_start;
+ assert(g->stack_start != NULL);
if (sz2 > sz1) {
char* c = PyMem_Realloc(g->stack_copy, sz2);
if (!c) {
@@ -378,7 +379,10 @@
/* start the greenlet */
ts_target->stack_start = NULL;
ts_target->stack_stop = (char*) mark;
- ts_target->stack_prev = ts_current;
+ if (ts_current->stack_start == NULL) /* ts_current is dying */
+ ts_target->stack_prev = ts_current->stack_prev;
+ else
+ ts_target->stack_prev = ts_current;
ts_target->top_frame = NULL;
ts_target->recursion_depth = PyThreadState_GET()->recursion_depth;
err = _PyGreen_switchstack();
More information about the pytest-commit
mailing list