Skip to content

Commit f21b38c

Browse files
[3.13] gh-127865: Fix build failure for systems without thread local support (GH-127866) (GH-127882)
This PR fixes the build issue introduced by the commit 628f6eb from GH-112207 on systems without thread local support. (cherry picked from commit f823910) Co-authored-by: velemas <10437413+velemas@users.noreply.github.com>
1 parent d51c144 commit f21b38c

File tree

2 files changed

+5
-4
lines changed

2 files changed

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

Python/import.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ const char *
747747
_PyImport_ResolveNameWithPackageContext(const char *name)
748748
{
749749
#ifndef HAVE_THREAD_LOCAL
750-
PyThread_acquire_lock(EXTENSIONS.mutex, WAIT_LOCK);
750+
PyMutex_Lock(&EXTENSIONS.mutex);
751751
#endif
752752
if (PKGCONTEXT != NULL) {
753753
const char *p = strrchr(PKGCONTEXT, '.');
@@ -757,7 +757,7 @@ _PyImport_ResolveNameWithPackageContext(const char *name)
757757
}
758758
}
759759
#ifndef HAVE_THREAD_LOCAL
760-
PyThread_release_lock(EXTENSIONS.mutex);
760+
PyMutex_Unlock(&EXTENSIONS.mutex);
761761
#endif
762762
return name;
763763
}
@@ -766,12 +766,12 @@ const char *
766766
_PyImport_SwapPackageContext(const char *newcontext)
767767
{
768768
#ifndef HAVE_THREAD_LOCAL
769-
PyThread_acquire_lock(EXTENSIONS.mutex, WAIT_LOCK);
769+
PyMutex_Lock(&EXTENSIONS.mutex);
770770
#endif
771771
const char *oldcontext = PKGCONTEXT;
772772
PKGCONTEXT = newcontext;
773773
#ifndef HAVE_THREAD_LOCAL
774-
PyThread_release_lock(EXTENSIONS.mutex);
774+
PyMutex_Unlock(&EXTENSIONS.mutex);
775775
#endif
776776
return oldcontext;
777777
}

0 commit comments

Comments
 (0)