Visitar URL original
Stackless issue #204: use normal SystemExit code path for the main ta… · akruis/cpython@34768b4 · GitHub
Skip to content

Commit 34768b4

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 d8cba5d (not yet merged).
1 parent 1dc7128 commit 34768b4

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/202
1316
The private include file "stackless_methods.h" is obsolete and has been
1417
removed.

‎Stackless/module/scheduling.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,14 +1393,14 @@ slp_tasklet_end(PyObject *retval)
13931393
*/
13941394
if (retval == NULL) {
13951395
int handled = 0;
1396-
if (PyErr_ExceptionMatches(PyExc_SystemExit)) {
1396+
if (!ismain && PyErr_ExceptionMatches(PyExc_SystemExit)) {
13971397
/* but if it is truly a SystemExit on the main thread, we want the exit! */
13981398
if (ts == SLP_INITIAL_TSTATE(ts) && !PyErr_ExceptionMatches(PyExc_TaskletExit)) {
13991399
if (ts->interp == _PyRuntime.interpreters.main) {
14001400
PyStackless_HandleSystemExit();
14011401
handled = 1; /* handler returned, it wants us to silence it */
14021402
}
1403-
} else if (!ismain) {
1403+
} else {
14041404
/* deal with TaskletExit on a non-main tasklet */
14051405
handled = 1;
14061406
}

0 commit comments

Comments
 (0)