diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-03-31 21:40:18 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-03-31 21:40:18 (GMT) |
commit | 61611f84c91b3cd6d70e8f554efcef243f3413d1 (patch) | |
tree | 89106dfe4a381a55b579a0149b72974a6314f9cf /Lib/test | |
parent | a6f278cfa237ae56bb24468baeed335540bf3b32 (diff) | |
download | cpython-61611f84c91b3cd6d70e8f554efcef243f3413d1.zip cpython-61611f84c91b3cd6d70e8f554efcef243f3413d1.tar.gz cpython-61611f84c91b3cd6d70e8f554efcef243f3413d1.tar.bz2 |
Merged revisions 70897 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r70897 | benjamin.peterson | 2009-03-31 16:34:42 -0500 (Tue, 31 Mar 2009) | 1 line
fix Thread.ident when it is the main thread or a dummy thread #5632
........
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_threading.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index c8f9cac..0057d0e 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -83,11 +83,24 @@ class ThreadTests(unittest.TestCase): t.join(NUMTASKS) self.assert_(not t.is_alive()) self.failIfEqual(t.ident, 0) + self.assertFalse(t.ident is None) self.assert_(re.match('<TestThread\(.*, \w+ -?\d+\)>', repr(t))) if verbose: print 'all tasks done' self.assertEqual(numrunning.get(), 0) + def test_ident_of_no_threading_threads(self): + # The ident still must work for the main thread and dummy threads. + self.assertFalse(threading.currentThread().ident is None) + def f(): + ident.append(threading.currentThread().ident) + done.set() + done = threading.Event() + ident = [] + thread.start_new_thread(f, ()) + done.wait() + self.assertFalse(ident[0] is None) + # run with a small(ish) thread stack size (256kB) def test_various_ops_small_stack(self): if verbose: |