summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_threading.py
diff options
context:
space:
mode:
authorJake Tesler <jake.tesler@gmail.com>2019-05-22 15:43:17 (GMT)
committerVictor Stinner <vstinner@redhat.com>2019-05-22 15:43:16 (GMT)
commitb121f63155d8e3c7c42ab6122e36eaf7f5e9f7f5 (patch)
treef8e48c2d296e82b1378bb2bf25a34e1ca8321c85 /Lib/test/test_threading.py
parentb3be4072888a4ce054993c2801802721466ea02d (diff)
downloadcpython-b121f63155d8e3c7c42ab6122e36eaf7f5e9f7f5.zip
cpython-b121f63155d8e3c7c42ab6122e36eaf7f5e9f7f5.tar.gz
cpython-b121f63155d8e3c7c42ab6122e36eaf7f5e9f7f5.tar.bz2
bpo-36084: Add native thread ID (TID) to threading.Thread (GH-13463)
Add native thread ID (TID) to threading.Thread objects (supported platforms: Windows, FreeBSD, Linux, macOS).
Diffstat (limited to 'Lib/test/test_threading.py')
-rw-r--r--Lib/test/test_threading.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 2ddc77b..33a25f3 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -104,6 +104,11 @@ class ThreadTests(BaseTestCase):
self.assertRegex(repr(t), r'^<TestThread\(.*, initial\)>$')
t.start()
+ if hasattr(threading, 'get_native_id'):
+ native_ids = set(t.native_id for t in threads) | {threading.get_native_id()}
+ self.assertNotIn(None, native_ids)
+ self.assertEqual(len(native_ids), NUMTASKS + 1)
+
if verbose:
print('waiting for all tasks to complete')
for t in threads: