diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-08-24 22:04:09 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-08-24 22:04:09 (GMT) |
commit | 74319ae219e049ae78897513b897c513f2d06445 (patch) | |
tree | d33588f2a4330c62f340ec51b9f4655b4a6d7fd7 /Objects | |
parent | c532b3c1cebdbdb2aac8dc3d2be3904d754aee9c (diff) | |
download | cpython-74319ae219e049ae78897513b897c513f2d06445.zip cpython-74319ae219e049ae78897513b897c513f2d06445.tar.gz cpython-74319ae219e049ae78897513b897c513f2d06445.tar.bz2 |
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.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/abstract.c | 2 | ||||
-rw-r--r-- | Objects/methodobject.c | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index 6db8c26..f302281 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -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; diff --git a/Objects/methodobject.c b/Objects/methodobject.c index edb2fc0..394f1f4 100644 --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -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 */ |