File indexing completed on 2025-01-18 10:06:47
0001 #ifndef Py_INTERNAL_TUPLE_H
0002 #define Py_INTERNAL_TUPLE_H
0003 #ifdef __cplusplus
0004 extern "C" {
0005 #endif
0006
0007 #ifndef Py_BUILD_CORE
0008 # error "this header requires Py_BUILD_CORE define"
0009 #endif
0010
0011 #include "tupleobject.h" /* _PyTuple_CAST() */
0012
0013
0014
0015
0016 extern PyStatus _PyTuple_InitGlobalObjects(PyInterpreterState *);
0017 extern void _PyTuple_Fini(PyInterpreterState *);
0018
0019
0020
0021
0022
0023
0024
0025 #if defined(PyTuple_MAXSAVESIZE) && PyTuple_MAXSAVESIZE <= 0
0026
0027 # define PyTuple_NFREELISTS 0
0028 # undef PyTuple_MAXSAVESIZE
0029 # undef PyTuple_MAXFREELIST
0030
0031 #elif !defined(WITH_FREELISTS)
0032 # define PyTuple_NFREELISTS 0
0033 # undef PyTuple_MAXSAVESIZE
0034 # undef PyTuple_MAXFREELIST
0035
0036 #else
0037
0038 # ifndef PyTuple_MAXSAVESIZE
0039 # define PyTuple_MAXSAVESIZE 20
0040 # endif
0041 # define PyTuple_NFREELISTS PyTuple_MAXSAVESIZE
0042 # ifndef PyTuple_MAXFREELIST
0043 # define PyTuple_MAXFREELIST 2000
0044 # endif
0045 #endif
0046
0047 struct _Py_tuple_state {
0048 #if PyTuple_NFREELISTS > 0
0049
0050
0051
0052
0053
0054
0055
0056
0057 PyTupleObject *free_list[PyTuple_NFREELISTS];
0058 int numfree[PyTuple_NFREELISTS];
0059 #else
0060 char _unused;
0061 #endif
0062 };
0063
0064 #define _PyTuple_ITEMS(op) _Py_RVALUE(_PyTuple_CAST(op)->ob_item)
0065
0066 extern PyObject *_PyTuple_FromArray(PyObject *const *, Py_ssize_t);
0067 extern PyObject *_PyTuple_FromArraySteal(PyObject *const *, Py_ssize_t);
0068
0069
0070 typedef struct {
0071 PyObject_HEAD
0072 Py_ssize_t it_index;
0073 PyTupleObject *it_seq;
0074 } _PyTupleIterObject;
0075
0076 #ifdef __cplusplus
0077 }
0078 #endif
0079 #endif