summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvelemas <10437413+velemas@users.noreply.github.com>2024-12-12 18:07:55 (GMT)
committerGitHub <noreply@github.com>2024-12-12 18:07:55 (GMT)
commitf823910bbd4bf01ec3e1ab7b3cb1d77815138296 (patch)
tree5974d03ced1e139304a92736317ec6a087cc5e9b
parentf8dcb8200626a1a06c4a26d8129257f42658a9ff (diff)
downloadcpython-f823910bbd4bf01ec3e1ab7b3cb1d77815138296.zip
cpython-f823910bbd4bf01ec3e1ab7b3cb1d77815138296.tar.gz
cpython-f823910bbd4bf01ec3e1ab7b3cb1d77815138296.tar.bz2
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.
-rw-r--r--Misc/NEWS.d/next/Build/2024-12-12-17-21-45.gh-issue-127865.30GDzs.rst1
-rw-r--r--Python/import.c8
2 files changed, 5 insertions, 4 deletions
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
index 0000000..3fc1d8a
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2024-12-12-17-21-45.gh-issue-127865.30GDzs.rst
@@ -0,0 +1 @@
+Fix build failure on systems without thread-locals support.
diff --git a/Python/import.c b/Python/import.c
index b3c384c..f3511aa 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -749,7 +749,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, '.');
@@ -759,7 +759,7 @@ _PyImport_ResolveNameWithPackageContext(const char *name)
}
}
#ifndef HAVE_THREAD_LOCAL
- PyThread_release_lock(EXTENSIONS.mutex);
+ PyMutex_Unlock(&EXTENSIONS.mutex);
#endif
return name;
}
@@ -768,12 +768,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;
}