Skip to content
Permalink
Browse files

bpo-32240: Add the const qualifier to declarations of PyObject* array…

… arguments. (#4746)
  • Loading branch information...
serhiy-storchaka committed Dec 15, 2017
1 parent 3325a67 commit a5552f023e1d8cbafee1e51d316cc581deb2295f
Showing with 669 additions and 662 deletions.
  1. +1 −1 Doc/c-api/veryhigh.rst
  2. +8 −8 Include/abstract.h
  3. +1 −1 Include/descrobject.h
  4. +6 −6 Include/eval.h
  5. +2 −2 Include/funcobject.h
  6. +6 −6 Include/methodobject.h
  7. +3 −3 Include/modsupport.h
  8. +1 −1 Include/unicodeobject.h
  9. +3 −3 Modules/_collectionsmodule.c
  10. +1 −1 Modules/_elementtree.c
  11. +1 −1 Modules/_hashopenssl.c
  12. +2 −2 Modules/_io/clinic/_iomodule.c.h
  13. +7 −7 Modules/_io/clinic/bufferedio.c.h
  14. +7 −7 Modules/_io/clinic/bytesio.c.h
  15. +4 −4 Modules/_io/clinic/fileio.c.h
  16. +4 −4 Modules/_io/clinic/iobase.c.h
  17. +5 −5 Modules/_io/clinic/stringio.c.h
  18. +7 −7 Modules/_io/clinic/textio.c.h
  19. +2 −2 Modules/_io/clinic/winconsoleio.c.h
  20. +3 −3 Modules/_sha3/clinic/sha3module.c.h
  21. +5 −5 Modules/_struct.c
  22. +8 −8 Modules/cjkcodecs/clinic/multibytecodec.c.h
  23. +7 −7 Modules/clinic/_asynciomodule.c.h
  24. +2 −2 Modules/clinic/_bz2module.c.h
  25. +43 −43 Modules/clinic/_codecsmodule.c.h
  26. +2 −2 Modules/clinic/_cryptmodule.c.h
  27. +2 −2 Modules/clinic/_datetimemodule.c.h
  28. +4 −4 Modules/clinic/_dbmmodule.c.h
  29. +14 −14 Modules/clinic/_elementtree.c.h
  30. +4 −4 Modules/clinic/_gdbmmodule.c.h
  31. +2 −2 Modules/clinic/_hashopenssl.c.h
  32. +3 −3 Modules/clinic/_lzmamodule.c.h
  33. +2 −2 Modules/clinic/_opcode.c.h
  34. +45 −45 Modules/clinic/_operator.c.h
  35. +6 −6 Modules/clinic/_pickle.c.h
  36. +17 −17 Modules/clinic/_sre.c.h
  37. +12 −12 Modules/clinic/_ssl.c.h
  38. +5 −5 Modules/clinic/_struct.c.h
  39. +7 −7 Modules/clinic/_tkinter.c.h
  40. +2 −2 Modules/clinic/_tracemalloc.c.h
  41. +2 −2 Modules/clinic/_weakref.c.h
  42. +17 −17 Modules/clinic/_winapi.c.h
  43. +5 −5 Modules/clinic/arraymodule.c.h
  44. +27 −27 Modules/clinic/audioop.c.h
  45. +7 −7 Modules/clinic/binascii.c.h
  46. +4 −4 Modules/clinic/cmathmodule.c.h
  47. +5 −5 Modules/clinic/fcntlmodule.c.h
  48. +2 −2 Modules/clinic/gcmodule.c.h
  49. +3 −3 Modules/clinic/grpmodule.c.h
  50. +7 −7 Modules/clinic/mathmodule.c.h
  51. +2 −2 Modules/clinic/md5module.c.h
  52. +104 −104 Modules/clinic/posixmodule.c.h
  53. +5 −5 Modules/clinic/pyexpat.c.h
  54. +2 −2 Modules/clinic/resource.c.h
  55. +2 −2 Modules/clinic/sha1module.c.h
  56. +3 −3 Modules/clinic/sha256module.c.h
  57. +3 −3 Modules/clinic/sha512module.c.h
  58. +7 −7 Modules/clinic/signalmodule.c.h
  59. +2 −2 Modules/clinic/symtablemodule.c.h
  60. +6 −6 Modules/clinic/unicodedata.c.h
  61. +3 −3 Modules/clinic/zipimport.c.h
  62. +10 −10 Modules/clinic/zlibmodule.c.h
  63. +25 −21 Objects/call.c
  64. +14 −14 Objects/clinic/bytearrayobject.c.h
  65. +11 −11 Objects/clinic/bytesobject.c.h
  66. +4 −4 Objects/clinic/dictobject.c.h
  67. +3 −3 Objects/clinic/floatobject.c.h
  68. +5 −5 Objects/clinic/listobject.c.h
  69. +3 −3 Objects/clinic/longobject.c.h
  70. +5 −5 Objects/clinic/odictobject.c.h
  71. +2 −2 Objects/clinic/tupleobject.c.h
  72. +14 −14 Objects/clinic/unicodeobject.c.h
  73. +1 −1 Objects/descrobject.c
  74. +1 −1 Objects/typeobject.c
  75. +1 −1 Objects/unicodeobject.c
  76. +3 −3 PC/clinic/_testconsole.c.h
  77. +6 −6 PC/clinic/msvcrtmodule.c.h
  78. +18 −18 PC/clinic/winreg.c.h
  79. +4 −4 PC/clinic/winsound.c.h
  80. +6 −6 Python/bltinmodule.c
  81. +7 −5 Python/ceval.c
  82. +2 −2 Python/clinic/_warnings.c.h
  83. +15 −15 Python/clinic/bltinmodule.c.h
  84. +4 −4 Python/clinic/import.c.h
  85. +3 −3 Python/clinic/marshal.c.h
  86. +15 −14 Python/getargs.c
  87. +1 −1 Python/sysmodule.c
  88. +2 −2 Tools/clinic/clinic.py
@@ -301,7 +301,7 @@ the same library that the Python runtime is using.
set to *NULL*.
.. c:function:: 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)
.. c:function:: PyObject* PyEval_EvalCodeEx(PyObject *co, PyObject *globals, PyObject *locals, PyObject *const *args, int argcount, PyObject *const *kws, int kwcount, PyObject *const *defs, int defcount, PyObject *kwdefs, PyObject *closure)
Evaluate a precompiled code object, given a particular environment for its
evaluation. This environment consists of a dictionary of global variables,
@@ -157,11 +157,11 @@ PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable,

#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) _PyStack_AsTuple(
PyObject **stack,
PyObject *const *stack,
Py_ssize_t nargs);

PyAPI_FUNC(PyObject*) _PyStack_AsTupleSlice(
PyObject **stack,
PyObject *const *stack,
Py_ssize_t nargs,
Py_ssize_t start,
Py_ssize_t end);
@@ -177,7 +177,7 @@ PyAPI_FUNC(PyObject*) _PyStack_AsTupleSlice(
an exception, the caller is responsible to implement an explicit keys on
kwnames. */
PyAPI_FUNC(PyObject *) _PyStack_AsDict(
PyObject **values,
PyObject *const *values,
PyObject *kwnames);

/* Convert (args, nargs, kwargs: dict) into a (stack, nargs, kwnames: tuple).
@@ -192,10 +192,10 @@ PyAPI_FUNC(PyObject *) _PyStack_AsDict(
The type of keyword keys is not checked, these checks should be done
later (ex: _PyArg_ParseStackAndKeywords). */
PyAPI_FUNC(int) _PyStack_UnpackDict(
PyObject **args,
PyObject *const *args,
Py_ssize_t nargs,
PyObject *kwargs,
PyObject ***p_stack,
PyObject *const **p_stack,
PyObject **p_kwnames);

/* Suggested size (number of positional arguments) for arrays of PyObject*
@@ -224,7 +224,7 @@ PyAPI_FUNC(int) _PyObject_HasFastCall(PyObject *callable);
error. */
PyAPI_FUNC(PyObject *) _PyObject_FastCallDict(
PyObject *callable,
PyObject **args,
PyObject *const *args,
Py_ssize_t nargs,
PyObject *kwargs);

@@ -245,7 +245,7 @@ PyAPI_FUNC(PyObject *) _PyObject_FastCallDict(
error. */
PyAPI_FUNC(PyObject *) _PyObject_FastCallKeywords(
PyObject *callable,
PyObject **args,
PyObject *const *args,
Py_ssize_t nargs,
PyObject *kwnames);

@@ -264,7 +264,7 @@ PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend(
PyAPI_FUNC(PyObject *) _PyObject_FastCall_Prepend(
PyObject *callable,
PyObject *obj,
PyObject **args,
PyObject *const *args,
Py_ssize_t nargs);

PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *callable,
@@ -92,7 +92,7 @@ PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
#ifndef Py_LIMITED_API

PyAPI_FUNC(PyObject *) _PyMethodDescr_FastCallKeywords(
PyObject *descrobj, PyObject **stack, Py_ssize_t nargs, PyObject *kwnames);
PyObject *descrobj, PyObject *const *stack, Py_ssize_t nargs, PyObject *kwnames);
PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
struct wrapperbase *, void *);
#define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL)
@@ -12,19 +12,19 @@ PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyObject *, PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyObject *co,
PyObject *globals,
PyObject *locals,
PyObject **args, int argc,
PyObject **kwds, int kwdc,
PyObject **defs, int defc,
PyObject *const *args, int argc,
PyObject *const *kwds, int kwdc,
PyObject *const *defs, int defc,
PyObject *kwdefs, PyObject *closure);

#ifndef Py_LIMITED_API
PyAPI_FUNC(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);

@@ -61,13 +61,13 @@ PyAPI_FUNC(int) PyFunction_SetAnnotations(PyObject *, PyObject *);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyFunction_FastCallDict(
PyObject *func,
PyObject **args,
PyObject *const *args,
Py_ssize_t nargs,
PyObject *kwargs);

PyAPI_FUNC(PyObject *) _PyFunction_FastCallKeywords(
PyObject *func,
PyObject **stack,
PyObject *const *stack,
Py_ssize_t nargs,
PyObject *kwnames);
#endif
@@ -16,11 +16,11 @@ PyAPI_DATA(PyTypeObject) PyCFunction_Type;
#define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type)

typedef PyObject *(*PyCFunction)(PyObject *, PyObject *);
typedef PyObject *(*_PyCFunctionFast) (PyObject *, PyObject **, Py_ssize_t);
typedef PyObject *(*_PyCFunctionFast) (PyObject *, PyObject *const *, Py_ssize_t);
typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *,
PyObject *);
typedef PyObject *(*_PyCFunctionFastWithKeywords) (PyObject *,
PyObject **, Py_ssize_t,
PyObject *const *, Py_ssize_t,
PyObject *);
typedef PyObject *(*PyNoArgsFunction)(PyObject *);

@@ -43,12 +43,12 @@ PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *);

#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyCFunction_FastCallDict(PyObject *func,
PyObject **args,
PyObject *const *args,
Py_ssize_t nargs,
PyObject *kwargs);

PyAPI_FUNC(PyObject *) _PyCFunction_FastCallKeywords(PyObject *func,
PyObject **stack,
PyObject *const *stack,
Py_ssize_t nargs,
PyObject *kwnames);
#endif
@@ -110,14 +110,14 @@ typedef struct {
PyAPI_FUNC(PyObject *) _PyMethodDef_RawFastCallDict(
PyMethodDef *method,
PyObject *self,
PyObject **args,
PyObject *const *args,
Py_ssize_t nargs,
PyObject *kwargs);

PyAPI_FUNC(PyObject *) _PyMethodDef_RawFastCallKeywords(
PyMethodDef *method,
PyObject *self,
PyObject **args,
PyObject *const *args,
Py_ssize_t nargs,
PyObject *kwnames);
#endif
@@ -52,7 +52,7 @@ PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...);

#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyArg_UnpackStack(
PyObject **args,
PyObject *const *args,
Py_ssize_t nargs,
const char *name,
Py_ssize_t min,
@@ -99,12 +99,12 @@ typedef struct _PyArg_Parser {
PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *,
struct _PyArg_Parser *, ...);
PyAPI_FUNC(int) _PyArg_ParseStack(
PyObject **args,
PyObject *const *args,
Py_ssize_t nargs,
const char *format,
...);
PyAPI_FUNC(int) _PyArg_ParseStackAndKeywords(
PyObject **args,
PyObject *const *args,
Py_ssize_t nargs,
PyObject *kwnames,
struct _PyArg_Parser *,
@@ -1979,7 +1979,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_Join(
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyUnicode_JoinArray(
PyObject *separator,
PyObject **items,
PyObject *const *items,
Py_ssize_t seqlen
);
#endif /* Py_LIMITED_API */
@@ -912,7 +912,7 @@ _deque_rotate(dequeobject *deque, Py_ssize_t n)
}

static PyObject *
deque_rotate(dequeobject *deque, PyObject **args, Py_ssize_t nargs)
deque_rotate(dequeobject *deque, PyObject *const *args, Py_ssize_t nargs)
{
Py_ssize_t n=1;

@@ -1045,7 +1045,7 @@ deque_len(dequeobject *deque)
}

static PyObject *
deque_index(dequeobject *deque, PyObject **args, Py_ssize_t nargs)
deque_index(dequeobject *deque, PyObject *const *args, Py_ssize_t nargs)
{
Py_ssize_t i, n, start=0, stop=Py_SIZE(deque);
PyObject *v, *item;
@@ -1122,7 +1122,7 @@ PyDoc_STRVAR(index_doc,
*/

static PyObject *
deque_insert(dequeobject *deque, PyObject **args, Py_ssize_t nargs)
deque_insert(dequeobject *deque, PyObject *const *args, Py_ssize_t nargs)
{
Py_ssize_t index;
Py_ssize_t n = Py_SIZE(deque);
@@ -2771,7 +2771,7 @@ typedef struct {
} XMLParserObject;

static PyObject*
_elementtree_XMLParser_doctype(XMLParserObject *self, PyObject **args, Py_ssize_t nargs);
_elementtree_XMLParser_doctype(XMLParserObject *self, PyObject *const *args, Py_ssize_t nargs);
static PyObject *
_elementtree_XMLParser_doctype_impl(XMLParserObject *self, PyObject *name,
PyObject *pubid, PyObject *system);
@@ -915,7 +915,7 @@ generate_hash_name_list(void)
*/
#define GEN_CONSTRUCTOR(NAME) \
static PyObject * \
EVP_new_ ## NAME (PyObject *self, PyObject **args, Py_ssize_t nargs) \
EVP_new_ ## NAME (PyObject *self, PyObject *const *args, Py_ssize_t nargs) \
{ \
PyObject *data_obj = NULL; \
Py_buffer view = { 0 }; \
@@ -135,7 +135,7 @@ _io_open_impl(PyObject *module, PyObject *file, const char *mode,
const char *newline, int closefd, PyObject *opener);

static PyObject *
_io_open(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"file", "mode", "buffering", "encoding", "errors", "newline", "closefd", "opener", NULL};
@@ -158,4 +158,4 @@ _io_open(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
exit:
return return_value;
}
/*[clinic end generated code: output=7e0ab289d8465580 input=a9049054013a1b77]*/
/*[clinic end generated code: output=a9de1ae79c960e81 input=a9049054013a1b77]*/
@@ -97,7 +97,7 @@ static PyObject *
_io__Buffered_peek_impl(buffered *self, Py_ssize_t size);

static PyObject *
_io__Buffered_peek(buffered *self, PyObject **args, Py_ssize_t nargs)
_io__Buffered_peek(buffered *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t size = 0;
@@ -124,7 +124,7 @@ static PyObject *
_io__Buffered_read_impl(buffered *self, Py_ssize_t n);

static PyObject *
_io__Buffered_read(buffered *self, PyObject **args, Py_ssize_t nargs)
_io__Buffered_read(buffered *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t n = -1;
@@ -151,7 +151,7 @@ static PyObject *
_io__Buffered_read1_impl(buffered *self, Py_ssize_t n);

static PyObject *
_io__Buffered_read1(buffered *self, PyObject **args, Py_ssize_t nargs)
_io__Buffered_read1(buffered *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t n = -1;
@@ -240,7 +240,7 @@ static PyObject *
_io__Buffered_readline_impl(buffered *self, Py_ssize_t size);

static PyObject *
_io__Buffered_readline(buffered *self, PyObject **args, Py_ssize_t nargs)
_io__Buffered_readline(buffered *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t size = -1;
@@ -267,7 +267,7 @@ static PyObject *
_io__Buffered_seek_impl(buffered *self, PyObject *targetobj, int whence);

static PyObject *
_io__Buffered_seek(buffered *self, PyObject **args, Py_ssize_t nargs)
_io__Buffered_seek(buffered *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *targetobj;
@@ -295,7 +295,7 @@ static PyObject *
_io__Buffered_truncate_impl(buffered *self, PyObject *pos);

static PyObject *
_io__Buffered_truncate(buffered *self, PyObject **args, Py_ssize_t nargs)
_io__Buffered_truncate(buffered *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *pos = Py_None;
@@ -476,4 +476,4 @@ _io_BufferedRandom___init__(PyObject *self, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
/*[clinic end generated code: output=2b817df0bf814ddc input=a9049054013a1b77]*/
/*[clinic end generated code: output=9a20dd4eaabb5d58 input=a9049054013a1b77]*/
@@ -164,7 +164,7 @@ static PyObject *
_io_BytesIO_read_impl(bytesio *self, Py_ssize_t size);

static PyObject *
_io_BytesIO_read(bytesio *self, PyObject **args, Py_ssize_t nargs)
_io_BytesIO_read(bytesio *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t size = -1;
@@ -195,7 +195,7 @@ static PyObject *
_io_BytesIO_read1_impl(bytesio *self, Py_ssize_t size);

static PyObject *
_io_BytesIO_read1(bytesio *self, PyObject **args, Py_ssize_t nargs)
_io_BytesIO_read1(bytesio *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t size = -1;
@@ -227,7 +227,7 @@ static PyObject *
_io_BytesIO_readline_impl(bytesio *self, Py_ssize_t size);

static PyObject *
_io_BytesIO_readline(bytesio *self, PyObject **args, Py_ssize_t nargs)
_io_BytesIO_readline(bytesio *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t size = -1;
@@ -259,7 +259,7 @@ static PyObject *
_io_BytesIO_readlines_impl(bytesio *self, PyObject *arg);

static PyObject *
_io_BytesIO_readlines(bytesio *self, PyObject **args, Py_ssize_t nargs)
_io_BytesIO_readlines(bytesio *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *arg = Py_None;
@@ -326,7 +326,7 @@ static PyObject *
_io_BytesIO_truncate_impl(bytesio *self, Py_ssize_t size);

static PyObject *
_io_BytesIO_truncate(bytesio *self, PyObject **args, Py_ssize_t nargs)
_io_BytesIO_truncate(bytesio *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t size = self->pos;
@@ -360,7 +360,7 @@ static PyObject *
_io_BytesIO_seek_impl(bytesio *self, Py_ssize_t pos, int whence);

static PyObject *
_io_BytesIO_seek(bytesio *self, PyObject **args, Py_ssize_t nargs)
_io_BytesIO_seek(bytesio *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t pos;
@@ -444,4 +444,4 @@ _io_BytesIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
/*[clinic end generated code: output=20946f5a2ed4492b input=a9049054013a1b77]*/
/*[clinic end generated code: output=9ba9a68c8c5669e7 input=a9049054013a1b77]*/

0 comments on commit a5552f0

Please sign in to comment.
You can’t perform that action at this time.