Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 69b82ef

Browse filesBrowse files
author
Anselm Kruis
committed
merge 3.3-slp (Stackless python#103)
2 parents bcdb319 + fdd70f2 commit 69b82ef
Copy full SHA for 69b82ef

File tree

Expand file treeCollapse file tree

3 files changed

+39
-1
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+39
-1
lines changed

‎Stackless/changelog.txt

Copy file name to clipboardExpand all lines: Stackless/changelog.txt
+3Lines 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://bitbucket.org/stackless-dev/stackless/issues/103
13+
Fix an invalid assertion during interpreter shutdown.
14+
1215
- https://bitbucket.org/stackless-dev/stackless/issues/101
1316
Enhance Tools/gdb/libpython.py to support debugging Stackless Python.
1417
You can now debug Stackless Python with gdb. Unfortunately gdb still

‎Stackless/core/stacklesseval.c

Copy file name to clipboardExpand all lines: Stackless/core/stacklesseval.c
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,10 @@ void slp_kill_tasks_with_stacks(PyThreadState *target_ts)
550550
if (t == NULL)
551551
continue;
552552
Py_INCREF(t); /* cs->task is a borrowed ref */
553-
assert(t->cstate == cs);
553+
if (t->cstate != cs) {
554+
Py_DECREF(t);
555+
continue; /* not the current cstate of the tasklet */
556+
}
554557
if (cs->tstate == cts) {
555558
Py_DECREF(t);
556559
continue; /* already handled */

‎Stackless/unittests/test_defects.py

Copy file name to clipboardExpand all lines: Stackless/unittests/test_defects.py
+32Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,38 @@ def other_thread_main():
414414
t.join()
415415
print("Done")
416416

417+
@unittest.skipUnless(withThreads, "requires thread support")
418+
def test_deep_thread(self):
419+
# test for issue #103 https://bitbucket.org/stackless-dev/stackless/issues/103/
420+
import subprocess
421+
rc = subprocess.call([sys.executable, "-S", "-E", "-c", """from __future__ import print_function, absolute_import\nif 1:
422+
import threading
423+
import stackless
424+
import time
425+
import sys
426+
from stackless import _test_nostacklesscall as apply
427+
428+
RECURSION_DEPTH = 200
429+
430+
event = threading.Event()
431+
432+
def recurse():
433+
if stackless.current.nesting_level < RECURSION_DEPTH:
434+
apply(recurse)
435+
else:
436+
event.set()
437+
time.sleep(10)
438+
439+
t = threading.Thread(target=recurse, name="other_thread")
440+
t.daemon = True
441+
t.start()
442+
event.wait(10)
443+
# print("end")
444+
sys.stdout.flush()
445+
sys.exit(42)
446+
"""])
447+
self.assertEqual(rc, 42)
448+
417449

418450
class TestStacklessProtokoll(StacklessTestCase):
419451
"""Various tests for violations of the STACKLESS_GETARG() STACKLESS_ASSERT() protocol

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.