Skip to content

Commit bf6b57b

Browse files
committed
Compare with _thread.get_ident()
1 parent 44876fb commit bf6b57b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Lib/test/test_capi/test_misc.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2897,6 +2897,18 @@ def run(self):
28972897
for tid in py_thread_ids:
28982898
self.assertIsInstance(tid, int)
28992899

2900+
# Compare _Py_ThreadId() with _thread.get_ident()
2901+
is_ident = False
2902+
if hasattr(os, 'uname'):
2903+
arch = os.uname().machine
2904+
else:
2905+
arch = ''
2906+
if sys.platform == 'linux' and arch == 'x86-64':
2907+
is_ident = True
2908+
if is_ident:
2909+
for thread in threads:
2910+
self.assertEqual(thread.py_tid, thread.ident)
2911+
29002912
# make sure that all _Py_ThreadId() are unique
29012913
self.assertEqual(len(set(py_thread_ids)), len(py_thread_ids),
29022914
py_thread_ids)

0 commit comments

Comments
 (0)