]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-127865: Fix build failure for systems without thread local support (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 12 Dec 2024 18:32:10 +0000 (19:32 +0100)
committerGitHub <noreply@github.com>
Thu, 12 Dec 2024 18:32:10 +0000 (18:32 +0000)
This PR fixes the build issue introduced by the commit 628f6eb from
GH-112207 on systems without thread local support.
(cherry picked from commit f823910bbd4bf01ec3e1ab7b3cb1d77815138296)

Co-authored-by: velemas <10437413+velemas@users.noreply.github.com>
Misc/NEWS.d/next/Build/2024-12-12-17-21-45.gh-issue-127865.30GDzs.rst [new file with mode: 0644]
Python/import.c

diff --git a/Misc/NEWS.d/next/Build/2024-12-12-17-21-45.gh-issue-127865.30GDzs.rst b/Misc/NEWS.d/next/Build/2024-12-12-17-21-45.gh-issue-127865.30GDzs.rst
new file mode 100644 (file)
index 0000000..3fc1d8a
--- /dev/null
@@ -0,0 +1 @@
+Fix build failure on systems without thread-locals support.
index ea5a3e4a7622d0b055d8779e84bd17d08eff5be7..755a6e45e6afa38e20fd0e4fc4e377c6dfbb0720 100644 (file)
@@ -747,7 +747,7 @@ const char *
 _PyImport_ResolveNameWithPackageContext(const char *name)
 {
 #ifndef HAVE_THREAD_LOCAL
-    PyThread_acquire_lock(EXTENSIONS.mutex, WAIT_LOCK);
+    PyMutex_Lock(&EXTENSIONS.mutex);
 #endif
     if (PKGCONTEXT != NULL) {
         const char *p = strrchr(PKGCONTEXT, '.');
@@ -757,7 +757,7 @@ _PyImport_ResolveNameWithPackageContext(const char *name)
         }
     }
 #ifndef HAVE_THREAD_LOCAL
-    PyThread_release_lock(EXTENSIONS.mutex);
+    PyMutex_Unlock(&EXTENSIONS.mutex);
 #endif
     return name;
 }
@@ -766,12 +766,12 @@ const char *
 _PyImport_SwapPackageContext(const char *newcontext)
 {
 #ifndef HAVE_THREAD_LOCAL
-    PyThread_acquire_lock(EXTENSIONS.mutex, WAIT_LOCK);
+    PyMutex_Lock(&EXTENSIONS.mutex);
 #endif
     const char *oldcontext = PKGCONTEXT;
     PKGCONTEXT = newcontext;
 #ifndef HAVE_THREAD_LOCAL
-    PyThread_release_lock(EXTENSIONS.mutex);
+    PyMutex_Unlock(&EXTENSIONS.mutex);
 #endif
     return oldcontext;
 }