Skip to content

Commit 85ec35d

Browse files
authored
gh-79315: Add Include/cpython/structseq.h header (#139730)
1 parent 5a77f02 commit 85ec35d

File tree

5 files changed

+20
-9
lines changed

5 files changed

+20
-9
lines changed

Include/cpython/structseq.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef Py_CPYTHON_STRUCTSEQ_H
2+
# error "this header file must not be included directly"
3+
#endif
4+
5+
PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type,
6+
PyStructSequence_Desc *desc);
7+
PyAPI_FUNC(int) PyStructSequence_InitType2(PyTypeObject *type,
8+
PyStructSequence_Desc *desc);
9+
10+
typedef PyTupleObject PyStructSequence;
11+
#define PyStructSequence_SET_ITEM PyStructSequence_SetItem
12+
#define PyStructSequence_GET_ITEM PyStructSequence_GetItem

Include/structseq.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ typedef struct PyStructSequence_Desc {
2121

2222
PyAPI_DATA(const char * const) PyStructSequence_UnnamedField;
2323

24-
#ifndef Py_LIMITED_API
25-
PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type,
26-
PyStructSequence_Desc *desc);
27-
PyAPI_FUNC(int) PyStructSequence_InitType2(PyTypeObject *type,
28-
PyStructSequence_Desc *desc);
29-
#endif
3024
PyAPI_FUNC(PyTypeObject*) PyStructSequence_NewType(PyStructSequence_Desc *desc);
3125

3226
PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type);
@@ -35,9 +29,9 @@ PyAPI_FUNC(void) PyStructSequence_SetItem(PyObject*, Py_ssize_t, PyObject*);
3529
PyAPI_FUNC(PyObject*) PyStructSequence_GetItem(PyObject*, Py_ssize_t);
3630

3731
#ifndef Py_LIMITED_API
38-
typedef PyTupleObject PyStructSequence;
39-
#define PyStructSequence_SET_ITEM PyStructSequence_SetItem
40-
#define PyStructSequence_GET_ITEM PyStructSequence_GetItem
32+
# define Py_CPYTHON_STRUCTSEQ_H
33+
# include "cpython/structseq.h"
34+
# undef Py_CPYTHON_STRUCTSEQ_H
4135
#endif
4236

4337
#ifdef __cplusplus

Makefile.pre.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,6 +1296,7 @@ PYTHON_HEADERS= \
12961296
$(srcdir)/Include/cpython/pythread.h \
12971297
$(srcdir)/Include/cpython/setobject.h \
12981298
$(srcdir)/Include/cpython/sliceobject.h \
1299+
$(srcdir)/Include/cpython/structseq.h \
12991300
$(srcdir)/Include/cpython/traceback.h \
13001301
$(srcdir)/Include/cpython/tracemalloc.h \
13011302
$(srcdir)/Include/cpython/tupleobject.h \

PCbuild/pythoncore.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
<ClInclude Include="..\Include\cpython\pythread.h" />
194194
<ClInclude Include="..\Include\cpython\setobject.h" />
195195
<ClInclude Include="..\Include\cpython\sliceobject.h" />
196+
<ClInclude Include="..\Include\cpython\structseq.h" />
196197
<ClInclude Include="..\Include\cpython\traceback.h" />
197198
<ClInclude Include="..\Include\cpython\tracemalloc.h" />
198199
<ClInclude Include="..\Include\cpython\tupleobject.h" />

PCbuild/pythoncore.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,9 @@
486486
<ClInclude Include="..\Include\cpython\pylifecycle.h">
487487
<Filter>Include\cpython</Filter>
488488
</ClInclude>
489+
<ClInclude Include="..\Include\cpython\structseq.h">
490+
<Filter>Include\cpython</Filter>
491+
</ClInclude>
489492
<ClInclude Include="..\Include\cpython\tupleobject.h">
490493
<Filter>Include\cpython</Filter>
491494
</ClInclude>

0 commit comments

Comments
 (0)