Skip to content

Commit ec13b93

Browse files
authored
bpo-35081: Add Include/internal/pycore_tupleobject.h (pythonGH-10705)
Move _PyTuple_ITEMS() to a new header file: Include/internal/pycore_tupleobject.h
1 parent 8ac6539 commit ec13b93

File tree

12 files changed

+30
-5
lines changed

12 files changed

+30
-5
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#ifndef Py_INTERNAL_TUPLEOBJECT_H
2+
#define Py_INTERNAL_TUPLEOBJECT_H
3+
#ifdef __cplusplus
4+
extern "C" {
5+
#endif
6+
7+
#if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
8+
# error "this header requires Py_BUILD_CORE or Py_BUILD_CORE_BUILTIN define"
9+
#endif
10+
11+
#include "tupleobject.h"
12+
13+
#define _PyTuple_ITEMS(op) (_PyTuple_CAST(op)->ob_item)
14+
15+
#ifdef __cplusplus
16+
}
17+
#endif
18+
#endif /* !Py_INTERNAL_TUPLEOBJECT_H */

Include/tupleobject.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *);
6161
#define PyTuple_GET_ITEM(op, i) (_PyTuple_CAST(op)->ob_item[i])
6262
#define PyTuple_GET_SIZE(op) (assert(PyTuple_Check(op)), Py_SIZE(op))
6363

64-
#ifdef Py_BUILD_CORE
65-
# define _PyTuple_ITEMS(op) (_PyTuple_CAST(op)->ob_item)
66-
#endif
67-
6864
/* Macro, *only* to be used to fill in brand new tuples */
6965
#define PyTuple_SET_ITEM(op, i, v) (_PyTuple_CAST(op)->ob_item[i] = v)
7066
#endif

Makefile.pre.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,7 @@ PYTHON_HEADERS= \
10431043
$(srcdir)/Include/internal/pycore_pylifecycle.h \
10441044
$(srcdir)/Include/internal/pycore_pymem.h \
10451045
$(srcdir)/Include/internal/pycore_pystate.h \
1046+
$(srcdir)/Include/internal/pycore_tupleobject.h \
10461047
$(srcdir)/Include/internal/pycore_warnings.h \
10471048
$(DTRACE_HEADERS)
10481049

Modules/_functoolsmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
21
#include "Python.h"
32
#include "pycore_pymem.h"
43
#include "pycore_pystate.h"
4+
#include "pycore_tupleobject.h"
55
#include "structmember.h"
66

77
/* _functools module written and maintained

Objects/call.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "Python.h"
22
#include "pycore_object.h"
33
#include "pycore_pystate.h"
4+
#include "pycore_tupleobject.h"
45
#include "frameobject.h"
56

67

Objects/codeobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "code.h"
55
#include "structmember.h"
66
#include "pycore_pystate.h"
7+
#include "pycore_tupleobject.h"
78

89
/* Holder for co_extra information */
910
typedef struct {

Objects/descrobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "Python.h"
44
#include "pycore_object.h"
55
#include "pycore_pystate.h"
6+
#include "pycore_tupleobject.h"
67
#include "structmember.h" /* Why is this not included in Python.h? */
78

89
/*[clinic input]

Objects/funcobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "pycore_object.h"
66
#include "pycore_pymem.h"
77
#include "pycore_pystate.h"
8+
#include "pycore_tupleobject.h"
89
#include "code.h"
910
#include "structmember.h"
1011

PCbuild/pythoncore.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
<ClInclude Include="..\Include\internal\pycore_pylifecycle.h" />
128128
<ClInclude Include="..\Include\internal\pycore_pymem.h" />
129129
<ClInclude Include="..\Include\internal\pycore_pystate.h" />
130+
<ClInclude Include="..\Include\internal\pycore_tupleobject.h" />
130131
<ClInclude Include="..\Include\internal\pycore_warnings.h" />
131132
<ClInclude Include="..\Include\intrcheck.h" />
132133
<ClInclude Include="..\Include\iterobject.h" />

PCbuild/pythoncore.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@
180180
<ClInclude Include="..\Include\internal\pycore_pystate.h">
181181
<Filter>Include</Filter>
182182
</ClInclude>
183+
<ClInclude Include="..\Include\internal\pycore_tupleobject.h">
184+
<Filter>Include</Filter>
185+
</ClInclude>
183186
<ClInclude Include="..\Include\internal\pycore_warnings.h">
184187
<Filter>Include</Filter>
185188
</ClInclude>

0 commit comments

Comments
 (0)