Skip to content

Commit 03ac090

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

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed
Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,8 @@ PyDescr_NewMethod(PyTypeObject *type, PyMethodDef *method)
892892
vectorcall = method_vectorcall_O;
893893
break;
894894
default:
895-
PyErr_SetString(PyExc_SystemError, "bad call flags");
895+
PyErr_Format(PyExc_SystemError,
896+
"%s() method: bad call flags", method->ml_name);
896897
return NULL;
897898
}
898899

Objects/methodobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ PyCFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module)
6262
vectorcall = cfunction_vectorcall_O;
6363
break;
6464
default:
65-
PyErr_SetString(PyExc_SystemError, "bad call flags");
65+
PyErr_Format(PyExc_SystemError,
66+
"%s() method: bad call flags", ml->ml_name);
6667
return NULL;
6768
}
6869

0 commit comments

Comments
 (0)