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.
This commit is contained in:
Victor Stinner 2020-03-12 08:38:11 +01:00 committed by GitHub
parent 1dd3794b19
commit c7d2d69d95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -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.

View File

@ -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;
}

View File

@ -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;
}