summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-11-09 15:56:48 (GMT)
committerGitHub <noreply@github.com>2018-11-09 15:56:48 (GMT)
commitd17a693fa08ce9f2d35acbb1f76e20bdae3e01da (patch)
treed3cd55ed960c8444a7411f1c21fc631ee19447c9 /Python
parent130893debfd97c70e3a89d9ba49892f53e6b9d79 (diff)
downloadcpython-d17a693fa08ce9f2d35acbb1f76e20bdae3e01da.zip
cpython-d17a693fa08ce9f2d35acbb1f76e20bdae3e01da.tar.gz
cpython-d17a693fa08ce9f2d35acbb1f76e20bdae3e01da.tar.bz2
bpo-35199: Add an internal _PyTuple_ITEMS() macro (GH-10434)
* _PyTuple_ITEMS() gives access to the tuple->ob_item field and cast the first argument to PyTupleObject*. This internal macro is only usable if Py_BUILD_CORE is defined. * Replace &PyTuple_GET_ITEM(ob, 0) with _PyTuple_ITEMS(ob). * Replace PyTuple_GET_ITEM(op, 1) with &_PyTuple_ITEMS(ob)[1].
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c2
-rw-r--r--Python/getargs.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index ac9db15..11be8ef 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4662,7 +4662,7 @@ do_call_core(PyObject *func, PyObject *callargs, PyObject *kwdict)
}
C_TRACE(result, _PyCFunction_FastCallDict(func,
- &PyTuple_GET_ITEM(callargs, 1),
+ &_PyTuple_ITEMS(callargs)[1],
nargs - 1,
kwdict));
Py_DECREF(func);
diff --git a/Python/getargs.c b/Python/getargs.c
index 98823f2..89df29e 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -422,7 +422,7 @@ vgetargs1(PyObject *args, const char *format, va_list *p_va, int flags)
return 0;
}
- stack = &PyTuple_GET_ITEM(args, 0);
+ stack = _PyTuple_ITEMS(args);
nargs = PyTuple_GET_SIZE(args);
}
else {
@@ -2254,7 +2254,7 @@ vgetargskeywordsfast(PyObject *args, PyObject *keywords,
return 0;
}
- stack = &PyTuple_GET_ITEM(args, 0);
+ stack = _PyTuple_ITEMS(args);
nargs = PyTuple_GET_SIZE(args);
return vgetargskeywordsfast_impl(stack, nargs, keywords, NULL,
parser, p_va, flags);
@@ -2461,7 +2461,7 @@ PyArg_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t m
"PyArg_UnpackTuple() argument list is not a tuple");
return 0;
}
- stack = &PyTuple_GET_ITEM(args, 0);
+ stack = _PyTuple_ITEMS(args);
nargs = PyTuple_GET_SIZE(args);
#ifdef HAVE_STDARG_PROTOTYPES