Skip to content

Commit bf7284a

Browse files
author
Anselm Kruis
committed
merge 3.3-slp (Stackless python#117, stackless.threads)
2 parents 230c713 + 052bcb8 commit bf7284a

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Stackless/changelog.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ What's New in Stackless 3.X.X?
2121
- https://bitbucket.org/stackless-dev/stackless/issues/117
2222
Fix various reference leaks:
2323
- Leak of a reference to Py_None in generator.throw()
24-
24+
- Leak of a reference to the thread-id of every thread returned by stackless.threads
25+
2526
Additionally this change brings the handling of caught exceptions more in
2627
line with C-Python.
2728

Stackless/module/stacklessmodule.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,9 +1524,16 @@ slpmodule_getthreads(PyObject *self)
15241524

15251525
for (ts = interp->tstate_head; ts != NULL; ts = ts->next) {
15261526
PyObject *id = PyLong_FromLong(ts->thread_id);
1527-
1528-
if (id == NULL || PyList_Append(lis, id))
1527+
if (id == NULL) {
1528+
Py_DECREF(lis);
1529+
return NULL;
1530+
}
1531+
if (PyList_Append(lis, id)) {
1532+
Py_DECREF(lis);
1533+
Py_DECREF(id);
15291534
return NULL;
1535+
}
1536+
Py_DECREF(id);
15301537
}
15311538
PyList_Reverse(lis);
15321539
return lis;

0 commit comments

Comments
 (0)