summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-07-03 06:02:15 (GMT)
committerGitHub <noreply@github.com>2024-07-03 06:02:15 (GMT)
commitff5806c78edda1feed61254ac55193772dc9ec48 (patch)
treeb7559dfb94f0ec9ade90ba96a2e6a853f6f4cd1e /Modules
parentf09d184821efd9438d092643881e28bdf8de4de5 (diff)
downloadcpython-ff5806c78edda1feed61254ac55193772dc9ec48.zip
cpython-ff5806c78edda1feed61254ac55193772dc9ec48.tar.gz
cpython-ff5806c78edda1feed61254ac55193772dc9ec48.tar.bz2
gh-121027: Make the functools.partial object a method descriptor (GH-121089)
Co-authored-by: d.grigonis <dgrigonis@users.noreply.github.com>
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_functoolsmodule.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index 564c271..64766b4 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -203,14 +203,7 @@ partial_descr_get(PyObject *self, PyObject *obj, PyObject *type)
if (obj == Py_None || obj == NULL) {
return Py_NewRef(self);
}
- if (PyErr_WarnEx(PyExc_FutureWarning,
- "functools.partial will be a method descriptor in "
- "future Python versions; wrap it in staticmethod() "
- "if you want to preserve the old behavior", 1) < 0)
- {
- return NULL;
- }
- return Py_NewRef(self);
+ return PyMethod_New(self, obj);
}
/* Merging keyword arguments using the vectorcall convention is messy, so