Skip to content

Commit df22055

Browse files
committed
Stackless issue python#204: use normal SystemExit code path for the main tasklet
Fix issue python#204 and bpo-24596. Now the special SystemExit handling is used for non-main tasklets of the main-thread of the primary interpreter only. A test case is in upstream commit e1ebf51 (not yet merged). (cherry picked from commit 34768b4)
1 parent 5cbfbe2 commit df22055

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎Stackless/changelog.txt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ What's New in Stackless 3.X.X?
99

1010
*Release date: 20XX-XX-XX*
1111

12+
- https://github.com/stackless-dev/stackless/issues/204
13+
Fix bpo-24596 for Stackless too.
14+
1215
- https://github.com/stackless-dev/stackless/issues/200
1316
Fix a bug in the C-API functions PyTasklet_Run_nr() and
1417
PyTasklet_Switch_nr(). Under exotic conditions the functions could

‎Stackless/module/scheduling.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,12 +1427,12 @@ slp_tasklet_end(PyObject *retval)
14271427
*/
14281428
if (retval == NULL) {
14291429
int handled = 0;
1430-
if (PyErr_ExceptionMatches(PyExc_SystemExit)) {
1430+
if (!ismain && PyErr_ExceptionMatches(PyExc_SystemExit)) {
14311431
/* but if it is truly a SystemExit on the main thread, we want the exit! */
14321432
if (ts == slp_initial_tstate && !PyErr_ExceptionMatches(PyExc_TaskletExit)) {
14331433
PyStackless_HandleSystemExit();
14341434
handled = 1; /* handler returned, it wants us to silence it */
1435-
} else if (!ismain) {
1435+
} else {
14361436
/* deal with TaskletExit on a non-main tasklet */
14371437
handled = 1;
14381438
}

0 commit comments

Comments
 (0)