diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2009-10-27 12:48:52 +0000 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2009-10-27 12:48:52 +0000 |
commit | 9aece75269872fa5cb942fb5ba642531de2d09fe (patch) | |
tree | ca8558eb2528580bd2eb07076be44a08a5ea54c9 /Lib/test/test_threading.py | |
parent | f75774b5420e18264fcf0cd0a845f4f7377b74b7 (diff) | |
download | cpython-git-9aece75269872fa5cb942fb5ba642531de2d09fe.tar.gz |
Merged revisions 75570,75574,75624 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r75570 | antoine.pitrou | 2009-10-20 23:29:37 +0200 (mar., 20 oct. 2009) | 6 lines
Issue #1722344: threading._shutdown() is now called in Py_Finalize(), which
fixes the problem of some exceptions being thrown at shutdown when the
interpreter is killed. Patch by Adam Olsen.
........
r75574 | antoine.pitrou | 2009-10-20 23:59:25 +0200 (mar., 20 oct. 2009) | 4 lines
Test wouldn't work in debug mode.
We probably need a function in test_support to handle this.
........
r75624 | antoine.pitrou | 2009-10-23 14:01:13 +0200 (ven., 23 oct. 2009) | 3 lines
Fix Windows buildbot failure
........
Diffstat (limited to 'Lib/test/test_threading.py')
-rw-r--r-- | Lib/test/test_threading.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index 0057d0e8f8..e9ff4cac88 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -284,6 +284,30 @@ class ThreadTests(unittest.TestCase): self.failIf(rc == 2, "interpreted was blocked") self.failUnless(rc == 0, "Unexpected error") + def test_join_nondaemon_on_shutdown(self): + # Issue 1722344 + # Raising SystemExit skipped threading._shutdown + import subprocess + p = subprocess.Popen([sys.executable, "-c", """if 1: + import threading + from time import sleep + + def child(): + sleep(1) + # As a non-daemon thread we SHOULD wake up and nothing + # should be torn down yet + print "Woke up, sleep function is:", sleep + + threading.Thread(target=child).start() + raise SystemExit + """], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + stdout, stderr = p.communicate() + self.assertEqual(stdout.strip(), + "Woke up, sleep function is: <built-in function sleep>") + stderr = re.sub(r"^\[\d+ refs\]", "", stderr, re.MULTILINE).strip() + self.assertEqual(stderr, "") def test_enumerate_after_join(self): # Try hard to trigger #1703448: a thread is still returned in |