diff options
-rw-r--r-- | Misc/NEWS.d/next/C API/2020-03-12-00-27-26.bpo-39884.CGOJBO.rst | 2 | ||||
-rw-r--r-- | Objects/descrobject.c | 3 | ||||
-rw-r--r-- | Objects/methodobject.c | 3 |
3 files changed, 6 insertions, 2 deletions
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 0000000..c65dfdc --- /dev/null +++ b/Misc/NEWS.d/next/C API/2020-03-12-00-27-26.bpo-39884.CGOJBO.rst @@ -0,0 +1,2 @@ +:c:func:`PyDescr_NewMethod` and :c:func:`PyCFunction_NewEx` now include the +method name in the SystemError "bad call flags" error message to ease debug. diff --git a/Objects/descrobject.c b/Objects/descrobject.c index 4ebbb74..b448ec6 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -888,7 +888,8 @@ PyDescr_NewMethod(PyTypeObject *type, PyMethodDef *method) vectorcall = method_vectorcall_O; break; default: - PyErr_SetString(PyExc_SystemError, "bad call flags"); + PyErr_Format(PyExc_SystemError, + "%s() method: bad call flags", method->ml_name); return NULL; } diff --git a/Objects/methodobject.c b/Objects/methodobject.c index 0d45705..16abded 100644 --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -56,7 +56,8 @@ PyCFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) vectorcall = cfunction_vectorcall_O; break; default: - PyErr_SetString(PyExc_SystemError, "bad call flags"); + PyErr_Format(PyExc_SystemError, + "%s() method: bad call flags", ml->ml_name); return NULL; } |