Skip to content

Commit da776ec

Browse files
author
Anselm Kruis
committed
merge 3.3-slp (Stackless python#117, tasklet.__setstate__())
2 parents 405a9cd + 119ca9b commit da776ec

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Stackless/changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ What's New in Stackless 3.X.X?
3434
a tasklet didn't run to its end or various other conditions. This part
3535
of the fix changes the Stackless reference counting for frames to follow
3636
the general rules for Python objects.
37+
- Leak of a reference to a frame in stackless.tasklet.__setstate__()
3738

3839
Additionally, this change brings the handling of caught exceptions more in
3940
line with C-Python.

Stackless/module/taskletobject.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,14 +515,17 @@ tasklet_setstate(PyObject *self, PyObject *args)
515515
PyFrameObject *back;
516516
f = (PyFrameObject *) PyList_GET_ITEM(lis, 0);
517517

518+
/* slp_ensure_new_frame() returns a new ref */
518519
if ((f = slp_ensure_new_frame(f)) == NULL)
519520
return NULL;
520521
back = f;
521522
for (i=1; i<nframes; ++i) {
522523
f = (PyFrameObject *) PyList_GET_ITEM(lis, i);
523-
if ((f = slp_ensure_new_frame(f)) == NULL)
524+
if ((f = slp_ensure_new_frame(f)) == NULL) {
525+
Py_DECREF(back);
524526
return NULL;
525-
Py_INCREF(back);
527+
}
528+
assert(f->f_back == NULL);
526529
f->f_back = back;
527530
back = f;
528531
}

0 commit comments

Comments
 (0)