Skip to content

Commit f823910

Browse files
authored
gh-127865: Fix build failure for systems without thread local support (GH-127866)
This PR fixes the build issue introduced by the commit 628f6eb from GH-112207 on systems without thread local support.
1 parent f8dcb82 commit f823910

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix build failure on systems without thread-locals support.

Python/import.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ const char *
749749
_PyImport_ResolveNameWithPackageContext(const char *name)
750750
{
751751
#ifndef HAVE_THREAD_LOCAL
752-
PyThread_acquire_lock(EXTENSIONS.mutex, WAIT_LOCK);
752+
PyMutex_Lock(&EXTENSIONS.mutex);
753753
#endif
754754
if (PKGCONTEXT != NULL) {
755755
const char *p = strrchr(PKGCONTEXT, '.');
@@ -759,7 +759,7 @@ _PyImport_ResolveNameWithPackageContext(const char *name)
759759
}
760760
}
761761
#ifndef HAVE_THREAD_LOCAL
762-
PyThread_release_lock(EXTENSIONS.mutex);
762+
PyMutex_Unlock(&EXTENSIONS.mutex);
763763
#endif
764764
return name;
765765
}
@@ -768,12 +768,12 @@ const char *
768768
_PyImport_SwapPackageContext(const char *newcontext)
769769
{
770770
#ifndef HAVE_THREAD_LOCAL
771-
PyThread_acquire_lock(EXTENSIONS.mutex, WAIT_LOCK);
771+
PyMutex_Lock(&EXTENSIONS.mutex);
772772
#endif
773773
const char *oldcontext = PKGCONTEXT;
774774
PKGCONTEXT = newcontext;
775775
#ifndef HAVE_THREAD_LOCAL
776-
PyThread_release_lock(EXTENSIONS.mutex);
776+
PyMutex_Unlock(&EXTENSIONS.mutex);
777777
#endif
778778
return oldcontext;
779779
}

0 commit comments

Comments
 (0)