Skip to content

Commit c7d2d69

Browse files
authored
bpo-39884: Add method name in "bad call flags" error (GH-18944)
PyDescr_NewMethod() and PyCFunction_NewEx() now include the method name in the SystemError "bad call flags" error message to ease debug.
1 parent 1dd3794 commit c7d2d69

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:c:func:`PyDescr_NewMethod` and :c:func:`PyCFunction_NewEx` now include the
2+
method name in the SystemError "bad call flags" error message to ease debug.

Objects/descrobject.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,8 @@ PyDescr_NewMethod(PyTypeObject *type, PyMethodDef *method)
888888
vectorcall = method_vectorcall_O;
889889
break;
890890
default:
891-
PyErr_SetString(PyExc_SystemError, "bad call flags");
891+
PyErr_Format(PyExc_SystemError,
892+
"%s() method: bad call flags", method->ml_name);
892893
return NULL;
893894
}
894895

Objects/methodobject.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ PyCFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module)
5656
vectorcall = cfunction_vectorcall_O;
5757
break;
5858
default:
59-
PyErr_SetString(PyExc_SystemError, "bad call flags");
59+
PyErr_Format(PyExc_SystemError,
60+
"%s() method: bad call flags", ml->ml_name);
6061
return NULL;
6162
}
6263

0 commit comments

Comments
 (0)