From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 2 Mar 2026 21:31:46 +0000 (+0100) Subject: [3.13] gh-143880: Fix data race in `functools.partial` in free threading build (GH... X-Git-Tag: v3.13.13~140 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fb340275c4246df8355a5641b64acdba5cd38ed6;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-143880: Fix data race in `functools.partial` in free threading build (GH-143882) (#145435) Co-authored-by: Sam Gross --- 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 000000000000..b77f86e5eb8f --- /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 cbbba322a182..40c573b3fdf7 100644 --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -220,7 +220,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);