https://github.com/python/cpython/commit/0042384bd56cf88c9bf868776247ef00b34719de
commit: 0042384bd56cf88c9bf868776247ef00b34719de
branch: 3.14
author: Sam Gross <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2026-01-16T22:25:40+05:30
summary:
[3.14] gh-143880: Fix data race in `functools.partial` in free threading build
(#143882)
gh-143880: Fix data race in `functools.partial` in free threading build
The assignment to `pto->vectorcall` isn't thread-safe in the free
threading build. Note that this is already fixed in the main branch.
files:
A Misc/NEWS.d/next/Library/2026-01-15-13-03-22.gh-issue-143880.sWoLsf.rst
M Modules/_functoolsmodule.c
diff --git
a/Misc/NEWS.d/next/Library/2026-01-15-13-03-22.gh-issue-143880.sWoLsf.rst
b/Misc/NEWS.d/next/Library/2026-01-15-13-03-22.gh-issue-143880.sWoLsf.rst
new file mode 100644
index 00000000000000..b77f86e5eb8f8f
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2026-01-15-13-03-22.gh-issue-143880.sWoLsf.rst
@@ -0,0 +1 @@
+Fix data race in :func:`functools.partial` in the :term:`free threading` build.
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index 3420e7d8c37b74..490c6b83d217b7 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -375,7 +375,9 @@ partial_vectorcall_fallback(PyThreadState *tstate,
partialobject *pto,
PyObject *const *args, size_t nargsf,
PyObject *kwnames)
{
+#ifndef Py_GIL_DISABLED
pto->vectorcall = NULL;
+#endif
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
return _PyObject_MakeTpCall(tstate, (PyObject *)pto, args, nargs, kwnames);
}
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]