Skip to content

Commit 27f3702

Browse files
committed
Add _PyArg_BadArgument
1 parent e418be0 commit 27f3702

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

graalpython/com.oracle.graal.python.cext/src/modsupport.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,3 +927,12 @@ _PyArg_UnpackKeywords(PyObject *const *args, Py_ssize_t nargs,
927927

928928
return buf;
929929
}
930+
931+
// Taken from CPython 3.8 getargs.c
932+
void _PyArg_BadArgument(const char *fname, const char *displayname,
933+
const char *expected, PyObject *arg) {
934+
PyErr_Format(PyExc_TypeError,
935+
"%.200s() %.200s must be %.50s, not %.50s",
936+
fname, displayname, expected,
937+
arg == Py_None ? "None" : arg->ob_type->tp_name);
938+
}

0 commit comments

Comments
 (0)