Commit 74319ae2 authored by Victor Stinner's avatar Victor Stinner

Use Py_ssize_t type for number of arguments

Issue #27848: use Py_ssize_t rather than C int for the number of function
positional and keyword arguments.
parent c532b3c1
......@@ -280,7 +280,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
Return the result on success. Raise an exception on return NULL on
error. */
PyAPI_FUNC(PyObject *) _PyObject_FastCallDict(PyObject *func,
PyObject **args, int nargs,
PyObject **args, Py_ssize_t nargs,
PyObject *kwargs);
#define _PyObject_FastCall(func, args, nargs) \
......
......@@ -61,7 +61,8 @@ PyAPI_FUNC(int) PyFunction_SetAnnotations(PyObject *, PyObject *);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyFunction_FastCallDict(
PyObject *func,
PyObject **args, int nargs,
PyObject **args,
Py_ssize_t nargs,
PyObject *kwargs);
#endif
......
......@@ -39,7 +39,8 @@ PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyCFunction_FastCallDict(PyObject *func,
PyObject **args, int nargs,
PyObject **args,
Py_ssize_t nargs,
PyObject *kwargs);
#endif
......
......@@ -2255,7 +2255,7 @@ _PyStack_AsTuple(PyObject **stack, Py_ssize_t nargs)
}
PyObject *
_PyObject_FastCallDict(PyObject *func, PyObject **args, int nargs,
_PyObject_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs,
PyObject *kwargs)
{
ternaryfunc call;
......
......@@ -146,15 +146,20 @@ PyCFunction_Call(PyObject *func, PyObject *args, PyObject *kwds)
}
PyObject *
_PyCFunction_FastCallDict(PyObject *func_obj, PyObject **args, int nargs,
_PyCFunction_FastCallDict(PyObject *func_obj, PyObject **args, Py_ssize_t nargs,
PyObject *kwargs)
{
PyCFunctionObject* func = (PyCFunctionObject*)func_obj;
PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
PyCFunction meth = PyCFunction_GET_FUNCTION(func);
PyObject *self = PyCFunction_GET_SELF(func);
PyObject *result;
int flags;
assert(func != NULL);
assert(nargs >= 0);
assert(nargs == 0 || args != NULL);
assert(kwargs == NULL || PyDict_Check(kwargs));
/* _PyCFunction_FastCallDict() must not be called with an exception set,
because it may clear it (directly or indirectly) and so the
caller loses its exception */
......
......@@ -2095,7 +2095,7 @@ builtin_sorted(PyObject *self, PyObject *args, PyObject *kwds)
PyObject *callable;
static char *kwlist[] = {"iterable", "key", "reverse", 0};
int reverse;
int nargs;
Py_ssize_t nargs;
/* args 1-3 should match listsort in Objects/listobject.c */
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|Oi:sorted",
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment