diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2009-10-20 22:08:36 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2009-10-20 22:08:36 (GMT) |
commit | cefb316e9ebc380a36ecea903755c38b08781cc4 (patch) | |
tree | 91615e0611b9eb145615dab772362e71ae1fd204 /Lib/test | |
parent | 2d4fce2dfbf6d54167a38ed1eff2e49188ac2958 (diff) | |
download | cpython-cefb316e9ebc380a36ecea903755c38b08781cc4.zip cpython-cefb316e9ebc380a36ecea903755c38b08781cc4.tar.gz cpython-cefb316e9ebc380a36ecea903755c38b08781cc4.tar.bz2 |
Merged revisions 75571,75576-75577 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r75571 | antoine.pitrou | 2009-10-20 23:52:47 +0200 (mar., 20 oct. 2009) | 11 lines
Merged revisions 75570 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.
........
................
r75576 | antoine.pitrou | 2009-10-21 00:02:29 +0200 (mer., 21 oct. 2009) | 10 lines
Merged revisions 75574 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
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.
........
................
r75577 | antoine.pitrou | 2009-10-21 00:05:38 +0200 (mer., 21 oct. 2009) | 3 lines
Another futile error in the previous commit :-(
................
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_threading.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index c7a2213..1e1e625 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -286,6 +286,29 @@ class ThreadTests(unittest.TestCase): self.assertFalse(rc == 2, "interpreted was blocked") self.assertTrue(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, b"Woke up, sleep function is: <built-in function sleep>\n") + stderr = re.sub(br"^\[\d+ refs\]", b"", stderr, re.MULTILINE).strip() + self.assertEqual(stderr, b"") def test_enumerate_after_join(self): # Try hard to trigger #1703448: a thread is still returned in |