mirror of https://github.com/python/cpython
gh-96125: Fix sys.thread_info.name on pthread platforms (GH-96126)
Automerge-Triggered-By: GH:tiran
This commit is contained in:
parent
5bfb3c372b
commit
822955c166
|
@ -628,6 +628,14 @@ class SysModuleTest(unittest.TestCase):
|
|||
self.assertEqual(len(info), 3)
|
||||
self.assertIn(info.name, ('nt', 'pthread', 'pthread-stubs', 'solaris', None))
|
||||
self.assertIn(info.lock, ('semaphore', 'mutex+cond', None))
|
||||
if sys.platform.startswith(("linux", "freebsd")):
|
||||
self.assertEqual(info.name, "pthread")
|
||||
elif sys.platform == "win32":
|
||||
self.assertEqual(info.name, "nt")
|
||||
elif sys.platform == "emscripten":
|
||||
self.assertIn(info.name, {"pthread", "pthread-stubs"})
|
||||
elif sys.platform == "wasi":
|
||||
self.assertEqual(info.name, "pthread-stubs")
|
||||
|
||||
@unittest.skipUnless(support.is_emscripten, "only available on Emscripten")
|
||||
def test_emscripten_info(self):
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Fix incorrect condition that causes ``sys.thread_info.name`` to be wrong on
|
||||
pthread platforms.
|
|
@ -59,7 +59,7 @@ PyThread_init_thread(void)
|
|||
# define PYTHREAD_NAME "pthread-stubs"
|
||||
# include "thread_pthread_stubs.h"
|
||||
#elif defined(_POSIX_THREADS)
|
||||
# if defined(__EMSCRIPTEN__) || !defined(__EMSCRIPTEN_PTHREADS__)
|
||||
# if defined(__EMSCRIPTEN__) && !defined(__EMSCRIPTEN_PTHREADS__)
|
||||
# define PYTHREAD_NAME "pthread-stubs"
|
||||
# else
|
||||
# define PYTHREAD_NAME "pthread"
|
||||
|
|
Loading…
Reference in New Issue