diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-12-15 11:11:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-15 11:11:11 (GMT) |
commit | a5552f023e1d8cbafee1e51d316cc581deb2295f (patch) | |
tree | f7cb07017f409fb035ec999efed8ddae18446865 /Python/getargs.c | |
parent | 3325a6780c81f1ea51190370b5454879c4862a37 (diff) | |
download | cpython-a5552f023e1d8cbafee1e51d316cc581deb2295f.zip cpython-a5552f023e1d8cbafee1e51d316cc581deb2295f.tar.gz cpython-a5552f023e1d8cbafee1e51d316cc581deb2295f.tar.bz2 |
bpo-32240: Add the const qualifier to declarations of PyObject* array arguments. (#4746)
Diffstat (limited to 'Python/getargs.c')
-rw-r--r-- | Python/getargs.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/Python/getargs.c b/Python/getargs.c index dd7ca9f..56e60f6 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -27,9 +27,10 @@ int _PyArg_VaParseTupleAndKeywordsFast(PyObject *, PyObject *, #ifdef HAVE_DECLSPEC_DLL /* Export functions */ PyAPI_FUNC(int) _PyArg_Parse_SizeT(PyObject *, const char *, ...); -PyAPI_FUNC(int) _PyArg_ParseStack_SizeT(PyObject **args, Py_ssize_t nargs, +PyAPI_FUNC(int) _PyArg_ParseStack_SizeT(PyObject *const *args, Py_ssize_t nargs, const char *format, ...); -PyAPI_FUNC(int) _PyArg_ParseStackAndKeywords_SizeT(PyObject **args, Py_ssize_t nargs, PyObject *kwnames, +PyAPI_FUNC(int) _PyArg_ParseStackAndKeywords_SizeT(PyObject *const *args, Py_ssize_t nargs, + PyObject *kwnames, struct _PyArg_Parser *parser, ...); PyAPI_FUNC(int) _PyArg_ParseTuple_SizeT(PyObject *, const char *, ...); PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywords_SizeT(PyObject *, PyObject *, @@ -69,7 +70,7 @@ typedef struct { #define STATIC_FREELIST_ENTRIES 8 /* Forward */ -static int vgetargs1_impl(PyObject *args, PyObject **stack, Py_ssize_t nargs, +static int vgetargs1_impl(PyObject *args, PyObject *const *stack, Py_ssize_t nargs, const char *format, va_list *p_va, int flags); static int vgetargs1(PyObject *, const char *, va_list *, int); static void seterror(Py_ssize_t, const char *, int *, const char *, const char *); @@ -86,7 +87,7 @@ static int vgetargskeywords(PyObject *, PyObject *, const char *, char **, va_list *, int); static int vgetargskeywordsfast(PyObject *, PyObject *, struct _PyArg_Parser *, va_list *, int); -static int vgetargskeywordsfast_impl(PyObject **args, Py_ssize_t nargs, +static int vgetargskeywordsfast_impl(PyObject *const *args, Py_ssize_t nargs, PyObject *keywords, PyObject *kwnames, struct _PyArg_Parser *parser, va_list *p_va, int flags); @@ -143,7 +144,7 @@ _PyArg_ParseTuple_SizeT(PyObject *args, const char *format, ...) int -_PyArg_ParseStack(PyObject **args, Py_ssize_t nargs, const char *format, ...) +_PyArg_ParseStack(PyObject *const *args, Py_ssize_t nargs, const char *format, ...) { int retval; va_list va; @@ -155,7 +156,7 @@ _PyArg_ParseStack(PyObject **args, Py_ssize_t nargs, const char *format, ...) } int -_PyArg_ParseStack_SizeT(PyObject **args, Py_ssize_t nargs, const char *format, ...) +_PyArg_ParseStack_SizeT(PyObject *const *args, Py_ssize_t nargs, const char *format, ...) { int retval; va_list va; @@ -250,7 +251,7 @@ cleanreturn(int retval, freelist_t *freelist) static int -vgetargs1_impl(PyObject *compat_args, PyObject **stack, Py_ssize_t nargs, const char *format, +vgetargs1_impl(PyObject *compat_args, PyObject *const *stack, Py_ssize_t nargs, const char *format, va_list *p_va, int flags) { char msgbuf[256]; @@ -1522,7 +1523,7 @@ _PyArg_ParseTupleAndKeywordsFast_SizeT(PyObject *args, PyObject *keywords, } int -_PyArg_ParseStackAndKeywords(PyObject **args, Py_ssize_t nargs, PyObject *kwnames, +_PyArg_ParseStackAndKeywords(PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames, struct _PyArg_Parser *parser, ...) { int retval; @@ -1535,7 +1536,7 @@ _PyArg_ParseStackAndKeywords(PyObject **args, Py_ssize_t nargs, PyObject *kwname } int -_PyArg_ParseStackAndKeywords_SizeT(PyObject **args, Py_ssize_t nargs, PyObject *kwnames, +_PyArg_ParseStackAndKeywords_SizeT(PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames, struct _PyArg_Parser *parser, ...) { int retval; @@ -1988,7 +1989,7 @@ parser_clear(struct _PyArg_Parser *parser) } static PyObject* -find_keyword(PyObject *kwargs, PyObject *kwnames, PyObject **kwstack, PyObject *key) +find_keyword(PyObject *kwargs, PyObject *kwnames, PyObject *const *kwstack, PyObject *key) { Py_ssize_t i, nkwargs; @@ -2017,7 +2018,7 @@ find_keyword(PyObject *kwargs, PyObject *kwnames, PyObject **kwstack, PyObject * } static int -vgetargskeywordsfast_impl(PyObject **args, Py_ssize_t nargs, +vgetargskeywordsfast_impl(PyObject *const *args, Py_ssize_t nargs, PyObject *kwargs, PyObject *kwnames, struct _PyArg_Parser *parser, va_list *p_va, int flags) @@ -2033,7 +2034,7 @@ vgetargskeywordsfast_impl(PyObject **args, Py_ssize_t nargs, PyObject *current_arg; freelistentry_t static_entries[STATIC_FREELIST_ENTRIES]; freelist_t freelist; - PyObject **kwstack = NULL; + PyObject *const *kwstack = NULL; freelist.entries = static_entries; freelist.first_available = 0; @@ -2395,7 +2396,7 @@ err: static int -unpack_stack(PyObject **args, Py_ssize_t nargs, const char *name, +unpack_stack(PyObject *const *args, Py_ssize_t nargs, const char *name, Py_ssize_t min, Py_ssize_t max, va_list vargs) { Py_ssize_t i; @@ -2472,7 +2473,7 @@ PyArg_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t m } int -_PyArg_UnpackStack(PyObject **args, Py_ssize_t nargs, const char *name, +_PyArg_UnpackStack(PyObject *const *args, Py_ssize_t nargs, const char *name, Py_ssize_t min, Py_ssize_t max, ...) { int retval; |