summaryrefslogtreecommitdiffstats
path: root/Objects/call.c
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 /Objects/call.c
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 'Objects/call.c')
-rw-r--r--Objects/call.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/Objects/call.c b/Objects/call.c
index 7b46dbc..b53a98c 100644
--- a/Objects/call.c
+++ b/Objects/call.c
@@ -81,7 +81,7 @@ _Py_CheckFunctionResult(PyObject *callable, PyObject *result, const char *where)
/* --- Core PyObject call functions ------------------------------- */
PyObject *
-_PyObject_FastCallDict(PyObject *callable, PyObject **args, Py_ssize_t nargs,
+_PyObject_FastCallDict(PyObject *callable, PyObject *const *args, Py_ssize_t nargs,
PyObject *kwargs)
{
/* _PyObject_FastCallDict() must not be called with an exception set,
@@ -134,7 +134,7 @@ _PyObject_FastCallDict(PyObject *callable, PyObject **args, Py_ssize_t nargs,
PyObject *
-_PyObject_FastCallKeywords(PyObject *callable, PyObject **stack, Py_ssize_t nargs,
+_PyObject_FastCallKeywords(PyObject *callable, PyObject *const *stack, Py_ssize_t nargs,
PyObject *kwnames)
{
/* _PyObject_FastCallKeywords() must not be called with an exception set,
@@ -254,7 +254,7 @@ PyObject_Call(PyObject *callable, PyObject *args, PyObject *kwargs)
/* --- PyFunction call functions ---------------------------------- */
static PyObject* _Py_HOT_FUNCTION
-function_code_fastcall(PyCodeObject *co, PyObject **args, Py_ssize_t nargs,
+function_code_fastcall(PyCodeObject *co, PyObject *const *args, Py_ssize_t nargs,
PyObject *globals)
{
PyFrameObject *f;
@@ -296,7 +296,7 @@ function_code_fastcall(PyCodeObject *co, PyObject **args, Py_ssize_t nargs,
PyObject *
-_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs,
+_PyFunction_FastCallDict(PyObject *func, PyObject *const *args, Py_ssize_t nargs,
PyObject *kwargs)
{
PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
@@ -383,7 +383,7 @@ _PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs,
}
PyObject *
-_PyFunction_FastCallKeywords(PyObject *func, PyObject **stack,
+_PyFunction_FastCallKeywords(PyObject *func, PyObject *const *stack,
Py_ssize_t nargs, PyObject *kwnames)
{
PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
@@ -443,8 +443,9 @@ _PyFunction_FastCallKeywords(PyObject *func, PyObject **stack,
/* --- PyCFunction call functions --------------------------------- */
PyObject *
-_PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self, PyObject **args,
- Py_ssize_t nargs, PyObject *kwargs)
+_PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self,
+ PyObject *const *args, Py_ssize_t nargs,
+ PyObject *kwargs)
{
/* _PyMethodDef_RawFastCallDict() must not be called with an exception set,
because it can clear it (directly or indirectly) and so the
@@ -532,7 +533,7 @@ _PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self, PyObject **arg
case METH_FASTCALL | METH_KEYWORDS:
{
- PyObject **stack;
+ PyObject *const *stack;
PyObject *kwnames;
_PyCFunctionFastWithKeywords fastmeth = (_PyCFunctionFastWithKeywords)meth;
@@ -542,7 +543,7 @@ _PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self, PyObject **arg
result = (*fastmeth) (self, stack, nargs, kwnames);
if (stack != args) {
- PyMem_Free(stack);
+ PyMem_Free((PyObject **)stack);
}
Py_XDECREF(kwnames);
break;
@@ -569,7 +570,8 @@ exit:
PyObject *
-_PyCFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs,
+_PyCFunction_FastCallDict(PyObject *func,
+ PyObject *const *args, Py_ssize_t nargs,
PyObject *kwargs)
{
PyObject *result;
@@ -586,8 +588,9 @@ _PyCFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs,
PyObject *
-_PyMethodDef_RawFastCallKeywords(PyMethodDef *method, PyObject *self, PyObject **args,
- Py_ssize_t nargs, PyObject *kwnames)
+_PyMethodDef_RawFastCallKeywords(PyMethodDef *method, PyObject *self,
+ PyObject *const *args, Py_ssize_t nargs,
+ PyObject *kwnames)
{
/* _PyMethodDef_RawFastCallKeywords() must not be called with an exception set,
because it can clear it (directly or indirectly) and so the
@@ -715,8 +718,9 @@ exit:
PyObject *
-_PyCFunction_FastCallKeywords(PyObject *func, PyObject **args,
- Py_ssize_t nargs, PyObject *kwnames)
+_PyCFunction_FastCallKeywords(PyObject *func,
+ PyObject *const *args, Py_ssize_t nargs,
+ PyObject *kwnames)
{
PyObject *result;
@@ -834,8 +838,8 @@ PyObject_CallObject(PyObject *callable, PyObject *args)
/* Positional arguments are obj followed by args:
call callable(obj, *args, **kwargs) */
PyObject *
-_PyObject_FastCall_Prepend(PyObject *callable,
- PyObject *obj, PyObject **args, Py_ssize_t nargs)
+_PyObject_FastCall_Prepend(PyObject *callable, PyObject *obj,
+ PyObject *const *args, Py_ssize_t nargs)
{
PyObject *small_stack[_PY_FASTCALL_SMALL_STACK];
PyObject **args2;
@@ -1268,7 +1272,7 @@ PyObject_CallFunctionObjArgs(PyObject *callable, ...)
/* Issue #29234: Inlining _PyStack_AsTuple() into callers increases their
stack consumption, Disable inlining to optimize the stack consumption. */
PyObject* _Py_NO_INLINE
-_PyStack_AsTuple(PyObject **stack, Py_ssize_t nargs)
+_PyStack_AsTuple(PyObject *const *stack, Py_ssize_t nargs)
{
PyObject *args;
Py_ssize_t i;
@@ -1288,7 +1292,7 @@ _PyStack_AsTuple(PyObject **stack, Py_ssize_t nargs)
PyObject*
-_PyStack_AsTupleSlice(PyObject **stack, Py_ssize_t nargs,
+_PyStack_AsTupleSlice(PyObject *const *stack, Py_ssize_t nargs,
Py_ssize_t start, Py_ssize_t end)
{
PyObject *args;
@@ -1313,7 +1317,7 @@ _PyStack_AsTupleSlice(PyObject **stack, Py_ssize_t nargs,
PyObject *
-_PyStack_AsDict(PyObject **values, PyObject *kwnames)
+_PyStack_AsDict(PyObject *const *values, PyObject *kwnames)
{
Py_ssize_t nkwargs;
PyObject *kwdict;
@@ -1340,8 +1344,8 @@ _PyStack_AsDict(PyObject **values, PyObject *kwnames)
int
-_PyStack_UnpackDict(PyObject **args, Py_ssize_t nargs, PyObject *kwargs,
- PyObject ***p_stack, PyObject **p_kwnames)
+_PyStack_UnpackDict(PyObject *const *args, Py_ssize_t nargs, PyObject *kwargs,
+ PyObject *const **p_stack, PyObject **p_kwnames)
{
PyObject **stack, **kwstack;
Py_ssize_t nkwargs;