summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-12-15 11:11:11 (GMT)
committerGitHub <noreply@github.com>2017-12-15 11:11:11 (GMT)
commita5552f023e1d8cbafee1e51d316cc581deb2295f (patch)
treef7cb07017f409fb035ec999efed8ddae18446865 /Python
parent3325a6780c81f1ea51190370b5454879c4862a37 (diff)
downloadcpython-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')
-rw-r--r--Python/bltinmodule.c12
-rw-r--r--Python/ceval.c12
-rw-r--r--Python/clinic/_warnings.c.h4
-rw-r--r--Python/clinic/bltinmodule.c.h30
-rw-r--r--Python/clinic/import.c.h8
-rw-r--r--Python/clinic/marshal.c.h6
-rw-r--r--Python/getargs.c29
-rw-r--r--Python/sysmodule.c2
8 files changed, 53 insertions, 50 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index a363211..604493d 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -126,7 +126,7 @@ error:
/* AC: cannot convert yet, waiting for *args support */
static PyObject *
-builtin___build_class__(PyObject *self, PyObject **args, Py_ssize_t nargs,
+builtin___build_class__(PyObject *self, PyObject *const *args, Py_ssize_t nargs,
PyObject *kwnames)
{
PyObject *func, *name, *bases, *mkw, *meta, *winner, *prep, *ns, *orig_bases;
@@ -515,7 +515,7 @@ builtin_callable(PyObject *module, PyObject *obj)
}
static PyObject *
-builtin_breakpoint(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *keywords)
+builtin_breakpoint(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *keywords)
{
PyObject *hook = PySys_GetObject("breakpointhook");
@@ -1112,7 +1112,7 @@ builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals,
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
static PyObject *
-builtin_getattr(PyObject *self, PyObject **args, Py_ssize_t nargs)
+builtin_getattr(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *v, *result, *dflt = NULL;
PyObject *name;
@@ -1417,7 +1417,7 @@ PyTypeObject PyMap_Type = {
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
static PyObject *
-builtin_next(PyObject *self, PyObject **args, Py_ssize_t nargs)
+builtin_next(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *it, *res;
PyObject *def = NULL;
@@ -1857,7 +1857,7 @@ builtin_pow_impl(PyObject *module, PyObject *x, PyObject *y, PyObject *z)
/* AC: cannot convert yet, waiting for *args support */
static PyObject *
-builtin_print(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+builtin_print(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
static const char * const _keywords[] = {"sep", "end", "file", "flush", 0};
static struct _PyArg_Parser _parser = {"|OOOO:print", _keywords, 0};
@@ -2242,7 +2242,7 @@ PyDoc_STRVAR(builtin_sorted__doc__,
{"sorted", (PyCFunction)builtin_sorted, METH_FASTCALL | METH_KEYWORDS, builtin_sorted__doc__},
static PyObject *
-builtin_sorted(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+builtin_sorted(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *newlist, *v, *seq, *callable;
diff --git a/Python/ceval.c b/Python/ceval.c
index f6519cf..287f1df 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -3703,10 +3703,10 @@ too_many_positional(PyCodeObject *co, Py_ssize_t given, Py_ssize_t defcount,
PyObject *
_PyEval_EvalCodeWithName(PyObject *_co, PyObject *globals, PyObject *locals,
- PyObject **args, Py_ssize_t argcount,
- PyObject **kwnames, PyObject **kwargs,
+ PyObject *const *args, Py_ssize_t argcount,
+ PyObject *const *kwnames, PyObject *const *kwargs,
Py_ssize_t kwcount, int kwstep,
- PyObject **defs, Py_ssize_t defcount,
+ PyObject *const *defs, Py_ssize_t defcount,
PyObject *kwdefs, PyObject *closure,
PyObject *name, PyObject *qualname)
{
@@ -3992,8 +3992,10 @@ fail: /* Jump here from prelude on failure */
PyObject *
PyEval_EvalCodeEx(PyObject *_co, PyObject *globals, PyObject *locals,
- PyObject **args, int argcount, PyObject **kws, int kwcount,
- PyObject **defs, int defcount, PyObject *kwdefs, PyObject *closure)
+ PyObject *const *args, int argcount,
+ PyObject *const *kws, int kwcount,
+ PyObject *const *defs, int defcount,
+ PyObject *kwdefs, PyObject *closure)
{
return _PyEval_EvalCodeWithName(_co, globals, locals,
args, argcount,
diff --git a/Python/clinic/_warnings.c.h b/Python/clinic/_warnings.c.h
index 334f9d1..68fad23 100644
--- a/Python/clinic/_warnings.c.h
+++ b/Python/clinic/_warnings.c.h
@@ -16,7 +16,7 @@ warnings_warn_impl(PyObject *module, PyObject *message, PyObject *category,
Py_ssize_t stacklevel, PyObject *source);
static PyObject *
-warnings_warn(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+warnings_warn(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"message", "category", "stacklevel", "source", NULL};
@@ -35,4 +35,4 @@ warnings_warn(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn
exit:
return return_value;
}
-/*[clinic end generated code: output=74b1a7d1ee41816d input=a9049054013a1b77]*/
+/*[clinic end generated code: output=86369ece63001d78 input=a9049054013a1b77]*/
diff --git a/Python/clinic/bltinmodule.c.h b/Python/clinic/bltinmodule.c.h
index 3647e62..285caf9 100644
--- a/Python/clinic/bltinmodule.c.h
+++ b/Python/clinic/bltinmodule.c.h
@@ -88,7 +88,7 @@ static PyObject *
builtin_format_impl(PyObject *module, PyObject *value, PyObject *format_spec);
static PyObject *
-builtin_format(PyObject *module, PyObject **args, Py_ssize_t nargs)
+builtin_format(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *value;
@@ -158,7 +158,7 @@ builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename,
int optimize);
static PyObject *
-builtin_compile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"source", "filename", "mode", "flags", "dont_inherit", "optimize", NULL};
@@ -193,7 +193,7 @@ static PyObject *
builtin_divmod_impl(PyObject *module, PyObject *x, PyObject *y);
static PyObject *
-builtin_divmod(PyObject *module, PyObject **args, Py_ssize_t nargs)
+builtin_divmod(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *x;
@@ -230,7 +230,7 @@ builtin_eval_impl(PyObject *module, PyObject *source, PyObject *globals,
PyObject *locals);
static PyObject *
-builtin_eval(PyObject *module, PyObject **args, Py_ssize_t nargs)
+builtin_eval(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *source;
@@ -268,7 +268,7 @@ builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals,
PyObject *locals);
static PyObject *
-builtin_exec(PyObject *module, PyObject **args, Py_ssize_t nargs)
+builtin_exec(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *source;
@@ -322,7 +322,7 @@ static PyObject *
builtin_hasattr_impl(PyObject *module, PyObject *obj, PyObject *name);
static PyObject *
-builtin_hasattr(PyObject *module, PyObject **args, Py_ssize_t nargs)
+builtin_hasattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *obj;
@@ -367,7 +367,7 @@ builtin_setattr_impl(PyObject *module, PyObject *obj, PyObject *name,
PyObject *value);
static PyObject *
-builtin_setattr(PyObject *module, PyObject **args, Py_ssize_t nargs)
+builtin_setattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *obj;
@@ -400,7 +400,7 @@ static PyObject *
builtin_delattr_impl(PyObject *module, PyObject *obj, PyObject *name);
static PyObject *
-builtin_delattr(PyObject *module, PyObject **args, Py_ssize_t nargs)
+builtin_delattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *obj;
@@ -509,7 +509,7 @@ static PyObject *
builtin_pow_impl(PyObject *module, PyObject *x, PyObject *y, PyObject *z);
static PyObject *
-builtin_pow(PyObject *module, PyObject **args, Py_ssize_t nargs)
+builtin_pow(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *x;
@@ -546,7 +546,7 @@ static PyObject *
builtin_input_impl(PyObject *module, PyObject *prompt);
static PyObject *
-builtin_input(PyObject *module, PyObject **args, Py_ssize_t nargs)
+builtin_input(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *prompt = NULL;
@@ -589,7 +589,7 @@ static PyObject *
builtin_round_impl(PyObject *module, PyObject *number, PyObject *ndigits);
static PyObject *
-builtin_round(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+builtin_round(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"number", "ndigits", NULL};
@@ -624,7 +624,7 @@ static PyObject *
builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start);
static PyObject *
-builtin_sum(PyObject *module, PyObject **args, Py_ssize_t nargs)
+builtin_sum(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *iterable;
@@ -659,7 +659,7 @@ builtin_isinstance_impl(PyObject *module, PyObject *obj,
PyObject *class_or_tuple);
static PyObject *
-builtin_isinstance(PyObject *module, PyObject **args, Py_ssize_t nargs)
+builtin_isinstance(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *obj;
@@ -694,7 +694,7 @@ builtin_issubclass_impl(PyObject *module, PyObject *cls,
PyObject *class_or_tuple);
static PyObject *
-builtin_issubclass(PyObject *module, PyObject **args, Py_ssize_t nargs)
+builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *cls;
@@ -710,4 +710,4 @@ builtin_issubclass(PyObject *module, PyObject **args, Py_ssize_t nargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=d46a224ac804eef1 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9f17c7a87d740374 input=a9049054013a1b77]*/
diff --git a/Python/clinic/import.c.h b/Python/clinic/import.c.h
index 1955e50..27b83ec 100644
--- a/Python/clinic/import.c.h
+++ b/Python/clinic/import.c.h
@@ -82,7 +82,7 @@ _imp__fix_co_filename_impl(PyObject *module, PyCodeObject *code,
PyObject *path);
static PyObject *
-_imp__fix_co_filename(PyObject *module, PyObject **args, Py_ssize_t nargs)
+_imp__fix_co_filename(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyCodeObject *code;
@@ -275,7 +275,7 @@ static PyObject *
_imp_create_dynamic_impl(PyObject *module, PyObject *spec, PyObject *file);
static PyObject *
-_imp_create_dynamic(PyObject *module, PyObject **args, Py_ssize_t nargs)
+_imp_create_dynamic(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *spec;
@@ -366,7 +366,7 @@ static PyObject *
_imp_source_hash_impl(PyObject *module, long key, Py_buffer *source);
static PyObject *
-_imp_source_hash(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+_imp_source_hash(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"key", "source", NULL};
@@ -396,4 +396,4 @@ exit:
#ifndef _IMP_EXEC_DYNAMIC_METHODDEF
#define _IMP_EXEC_DYNAMIC_METHODDEF
#endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */
-/*[clinic end generated code: output=e8b2c0b0d0a75da8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f0660cd1de6b3a73 input=a9049054013a1b77]*/
diff --git a/Python/clinic/marshal.c.h b/Python/clinic/marshal.c.h
index a946635..1ae9332 100644
--- a/Python/clinic/marshal.c.h
+++ b/Python/clinic/marshal.c.h
@@ -27,7 +27,7 @@ marshal_dump_impl(PyObject *module, PyObject *value, PyObject *file,
int version);
static PyObject *
-marshal_dump(PyObject *module, PyObject **args, Py_ssize_t nargs)
+marshal_dump(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *value;
@@ -84,7 +84,7 @@ static PyObject *
marshal_dumps_impl(PyObject *module, PyObject *value, int version);
static PyObject *
-marshal_dumps(PyObject *module, PyObject **args, Py_ssize_t nargs)
+marshal_dumps(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *value;
@@ -134,4 +134,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=15e284a34abfd26a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=584eb2222d86fdc3 input=a9049054013a1b77]*/
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;
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 24098b9..c054243 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -97,7 +97,7 @@ PySys_SetObject(const char *name, PyObject *v)
}
static PyObject *
-sys_breakpointhook(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *keywords)
+sys_breakpointhook(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *keywords)
{
assert(!PyErr_Occurred());
const char *envar = Py_GETENV("PYTHONBREAKPOINT");