]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-39884: Add method name in "bad call flags" error (GH-18944) (GH-18957)
authorVictor Stinner <vstinner@python.org>
Thu, 12 Mar 2020 12:37:08 +0000 (13:37 +0100)
committerGitHub <noreply@github.com>
Thu, 12 Mar 2020 12:37:08 +0000 (13:37 +0100)
_PyMethodDef_RawFastCallDict() and _PyMethodDef_RawFastCallKeywords()
now include the method name in the SystemError "bad call flags" error
message to ease debug.

(cherry picked from commit c7d2d69d95b263ee5f83511bc6fbe53acdc24ea3)

Misc/NEWS.d/next/C API/2020-03-12-00-27-26.bpo-39884.CGOJBO.rst [new file with mode: 0644]
Objects/call.c

diff --git a/Misc/NEWS.d/next/C API/2020-03-12-00-27-26.bpo-39884.CGOJBO.rst b/Misc/NEWS.d/next/C API/2020-03-12-00-27-26.bpo-39884.CGOJBO.rst
new file mode 100644 (file)
index 0000000..4169e83
--- /dev/null
@@ -0,0 +1,3 @@
+:c:func:`_PyMethodDef_RawFastCallDict` and
+:c:func:`_PyMethodDef_RawFastCallKeywords` now include the method name in the
+SystemError "bad call flags" error message to ease debug.
index 1209ed3977c72a0aedc5a0be9c1842cb550f02a9..63d6a14b5f9b74267817955cda361e5b07381b8d 100644 (file)
@@ -554,9 +554,8 @@ _PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self,
     }
 
     default:
-        PyErr_SetString(PyExc_SystemError,
-                        "Bad call flags in _PyMethodDef_RawFastCallDict. "
-                        "METH_OLDARGS is no longer supported!");
+        PyErr_Format(PyExc_SystemError,
+                     "%s() method: bad call flags", method->ml_name);
         goto exit;
     }
 
@@ -702,9 +701,8 @@ _PyMethodDef_RawFastCallKeywords(PyMethodDef *method, PyObject *self,
     }
 
     default:
-        PyErr_SetString(PyExc_SystemError,
-                        "Bad call flags in _PyMethodDef_RawFastCallKeywords. "
-                        "METH_OLDARGS is no longer supported!");
+        PyErr_Format(PyExc_SystemError,
+                     "%s() method: bad call flags", method->ml_name);
         goto exit;
     }