From 6a12676b1910d52c85561bdf4f1e20aa13fc8f46 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 12 Mar 2020 13:37:08 +0100 Subject: [PATCH] bpo-39884: Add method name in "bad call flags" error (GH-18944) (GH-18957) _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) --- .../C API/2020-03-12-00-27-26.bpo-39884.CGOJBO.rst | 3 +++ Objects/call.c | 10 ++++------ 2 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 Misc/NEWS.d/next/C API/2020-03-12-00-27-26.bpo-39884.CGOJBO.rst 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 index 000000000000..4169e839eba6 --- /dev/null +++ b/Misc/NEWS.d/next/C API/2020-03-12-00-27-26.bpo-39884.CGOJBO.rst @@ -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. diff --git a/Objects/call.c b/Objects/call.c index 1209ed3977c7..63d6a14b5f9b 100644 --- a/Objects/call.c +++ b/Objects/call.c @@ -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; } -- 2.47.3