Skip to content

Commit 6a12676

Browse files
authored
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 c7d2d69)
1 parent 6f4e7fc commit 6a12676

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:c:func:`_PyMethodDef_RawFastCallDict` and
2+
:c:func:`_PyMethodDef_RawFastCallKeywords` now include the method name in the
3+
SystemError "bad call flags" error message to ease debug.

Objects/call.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -554,9 +554,8 @@ _PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self,
554554
}
555555

556556
default:
557-
PyErr_SetString(PyExc_SystemError,
558-
"Bad call flags in _PyMethodDef_RawFastCallDict. "
559-
"METH_OLDARGS is no longer supported!");
557+
PyErr_Format(PyExc_SystemError,
558+
"%s() method: bad call flags", method->ml_name);
560559
goto exit;
561560
}
562561

@@ -702,9 +701,8 @@ _PyMethodDef_RawFastCallKeywords(PyMethodDef *method, PyObject *self,
702701
}
703702

704703
default:
705-
PyErr_SetString(PyExc_SystemError,
706-
"Bad call flags in _PyMethodDef_RawFastCallKeywords. "
707-
"METH_OLDARGS is no longer supported!");
704+
PyErr_Format(PyExc_SystemError,
705+
"%s() method: bad call flags", method->ml_name);
708706
goto exit;
709707
}
710708

0 commit comments

Comments
 (0)