Skip to content

Commit af16886

Browse files
committed
Add C API function '_PyArg_NoPositional'.
1 parent e136382 commit af16886

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,3 +875,20 @@ int _PyArg_NoKeywords(const char *funcname, PyObject *kw) {
875875
funcname);
876876
return 0;
877877
}
878+
879+
int
880+
_PyArg_NoPositional(const char *funcname, PyObject *args)
881+
{
882+
if (args == NULL)
883+
return 1;
884+
if (!PyTuple_CheckExact(args)) {
885+
PyErr_BadInternalCall();
886+
return 0;
887+
}
888+
if (PyTuple_GET_SIZE(args) == 0)
889+
return 1;
890+
891+
PyErr_Format(PyExc_TypeError, "%s does not take positional arguments",
892+
funcname);
893+
return 0;
894+
}

0 commit comments

Comments
 (0)