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 c7d2d69d95b263ee5f83511bc6fbe53acdc24ea3)
diff --git a/Objects/methodobject.c b/Objects/methodobject.c
index 3494f11..3604a55 100644
--- a/Objects/methodobject.c
+++ b/Objects/methodobject.c
@@ -62,7 +62,8 @@
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;
}