[Python-checkins] bpo-39884: Add method name in "bad call flags" error (GH-18944) (GH-18957)
Victor Stinner
webhook-mailer at python.org
Thu Mar 12 08:37:26 EDT 2020
https://github.com/python/cpython/commit/6a12676b1910d52c85561bdf4f1e20aa13fc8f46
commit: 6a12676b1910d52c85561bdf4f1e20aa13fc8f46
branch: 3.7
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020年03月12日T13:37:08+01:00
summary:
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)
files:
A Misc/NEWS.d/next/C API/2020-03-12-00-27-26.bpo-39884.CGOJBO.rst
M 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
index 0000000000000..4169e839eba69
--- /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 1209ed3977c72..63d6a14b5f9b7 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;
}
More information about the Python-checkins
mailing list