diff options
author | Victor Stinner <vstinner@redhat.com> | 2018-11-28 12:01:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-28 12:01:32 (GMT) |
commit | 54ba556c6c7d8fd5504dc142c2e773890c55a774 (patch) | |
tree | ba8cce6da1e07bbfd54e31f8f00172bd218222c5 /Include/tupleobject.h | |
parent | bde9d6bbb46ca59bcee5d5060adaa33c3ffee3a6 (diff) | |
download | cpython-54ba556c6c7d8fd5504dc142c2e773890c55a774.zip cpython-54ba556c6c7d8fd5504dc142c2e773890c55a774.tar.gz cpython-54ba556c6c7d8fd5504dc142c2e773890c55a774.tar.bz2 |
bpo-35134: Create Include/cpython/tupleobject.h (GH-10764)
Move tupleobject.h code surrounded by "#ifndef Py_LIMITED_API"
to a new Include/cpython/tupleobject.h header file.
Add cpython/ header files to Makefile.pre.in and pythoncore project
of PCbuild.
Diffstat (limited to 'Include/tupleobject.h')
-rw-r--r-- | Include/tupleobject.h | 38 |
1 files changed, 5 insertions, 33 deletions
diff --git a/Include/tupleobject.h b/Include/tupleobject.h index 75574bc..590902d 100644 --- a/Include/tupleobject.h +++ b/Include/tupleobject.h @@ -1,4 +1,3 @@ - /* Tuple object interface */ #ifndef Py_TUPLEOBJECT_H @@ -21,18 +20,6 @@ inserted in the tuple. Similarly, PyTuple_GetItem does not increment the returned item's reference count. */ -#ifndef Py_LIMITED_API -typedef struct { - PyObject_VAR_HEAD - PyObject *ob_item[1]; - - /* ob_item contains space for 'ob_size' elements. - * Items must normally not be NULL, except during construction when - * the tuple is not yet visible outside the function that builds it. - */ -} PyTupleObject; -#endif - PyAPI_DATA(PyTypeObject) PyTuple_Type; PyAPI_DATA(PyTypeObject) PyTupleIter_Type; @@ -45,30 +32,15 @@ PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *); PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, Py_ssize_t, PyObject *); PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t); -#ifndef Py_LIMITED_API -PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t); -#endif PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...); -#ifndef Py_LIMITED_API -PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *); -#endif - -/* Macro, trading safety for speed */ -#ifndef Py_LIMITED_API -/* Cast argument to PyTupleObject* type. */ -#define _PyTuple_CAST(op) (assert(PyTuple_Check(op)), (PyTupleObject *)(op)) - -#define PyTuple_GET_ITEM(op, i) (_PyTuple_CAST(op)->ob_item[i]) -#define PyTuple_GET_SIZE(op) Py_SIZE(_PyTuple_CAST(op)) - -/* Macro, *only* to be used to fill in brand new tuples */ -#define PyTuple_SET_ITEM(op, i, v) (_PyTuple_CAST(op)->ob_item[i] = v) -#endif PyAPI_FUNC(int) PyTuple_ClearFreeList(void); + #ifndef Py_LIMITED_API -PyAPI_FUNC(void) _PyTuple_DebugMallocStats(FILE *out); -#endif /* Py_LIMITED_API */ +# define Py_CPYTHON_TUPLEOBJECT_H +# include "cpython/tupleobject.h" +# undef Py_CPYTHON_TUPLEOBJECT_H +#endif #ifdef __cplusplus } |