]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-79315: Add Include/cpython/structseq.h header (#139730)
authorVictor Stinner <vstinner@python.org>
Tue, 7 Oct 2025 23:19:50 +0000 (01:19 +0200)
committerGitHub <noreply@github.com>
Tue, 7 Oct 2025 23:19:50 +0000 (01:19 +0200)
Include/cpython/structseq.h [new file with mode: 0644]
Include/structseq.h
Makefile.pre.in
PCbuild/pythoncore.vcxproj
PCbuild/pythoncore.vcxproj.filters

diff --git a/Include/cpython/structseq.h b/Include/cpython/structseq.h
new file mode 100644 (file)
index 0000000..328fbe8
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef Py_CPYTHON_STRUCTSEQ_H
+#  error "this header file must not be included directly"
+#endif
+
+PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type,
+                                           PyStructSequence_Desc *desc);
+PyAPI_FUNC(int) PyStructSequence_InitType2(PyTypeObject *type,
+                                           PyStructSequence_Desc *desc);
+
+typedef PyTupleObject PyStructSequence;
+#define PyStructSequence_SET_ITEM PyStructSequence_SetItem
+#define PyStructSequence_GET_ITEM PyStructSequence_GetItem
index 29e24fee54e6135ee93be1f3faf4d4b7d914c8f3..e52d6188030af9d2ddede71ef3fdfb0d2b410924 100644 (file)
@@ -21,12 +21,6 @@ typedef struct PyStructSequence_Desc {
 
 PyAPI_DATA(const char * const) PyStructSequence_UnnamedField;
 
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type,
-                                           PyStructSequence_Desc *desc);
-PyAPI_FUNC(int) PyStructSequence_InitType2(PyTypeObject *type,
-                                           PyStructSequence_Desc *desc);
-#endif
 PyAPI_FUNC(PyTypeObject*) PyStructSequence_NewType(PyStructSequence_Desc *desc);
 
 PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type);
@@ -35,9 +29,9 @@ PyAPI_FUNC(void) PyStructSequence_SetItem(PyObject*, Py_ssize_t, PyObject*);
 PyAPI_FUNC(PyObject*) PyStructSequence_GetItem(PyObject*, Py_ssize_t);
 
 #ifndef Py_LIMITED_API
-typedef PyTupleObject PyStructSequence;
-#define PyStructSequence_SET_ITEM PyStructSequence_SetItem
-#define PyStructSequence_GET_ITEM PyStructSequence_GetItem
+#  define Py_CPYTHON_STRUCTSEQ_H
+#  include "cpython/structseq.h"
+#  undef Py_CPYTHON_STRUCTSEQ_H
 #endif
 
 #ifdef __cplusplus
index 061305a9ed11a74b378b58a3ad71122221da86dc..987d55a9bdbd3b574c46a102e38b4b22c1d91426 100644 (file)
@@ -1296,6 +1296,7 @@ PYTHON_HEADERS= \
                $(srcdir)/Include/cpython/pythread.h \
                $(srcdir)/Include/cpython/setobject.h \
                $(srcdir)/Include/cpython/sliceobject.h \
+               $(srcdir)/Include/cpython/structseq.h \
                $(srcdir)/Include/cpython/traceback.h \
                $(srcdir)/Include/cpython/tracemalloc.h \
                $(srcdir)/Include/cpython/tupleobject.h \
index 248b63f25775da7ae61dc3c573fcb2344277c8c3..71f508a7e8b5fbd63f806d55774f063249adc4a6 100644 (file)
     <ClInclude Include="..\Include\cpython\pythread.h" />
     <ClInclude Include="..\Include\cpython\setobject.h" />
     <ClInclude Include="..\Include\cpython\sliceobject.h" />
+    <ClInclude Include="..\Include\cpython\structseq.h" />
     <ClInclude Include="..\Include\cpython\traceback.h" />
     <ClInclude Include="..\Include\cpython\tracemalloc.h" />
     <ClInclude Include="..\Include\cpython\tupleobject.h" />
index da07a139b7c93d05132b884c232ff7b3356787c7..547e9ee1abf3704f76b16d0d6ecb506c6139d7f0 100644 (file)
     <ClInclude Include="..\Include\cpython\pylifecycle.h">
       <Filter>Include\cpython</Filter>
     </ClInclude>
+    <ClInclude Include="..\Include\cpython\structseq.h">
+      <Filter>Include\cpython</Filter>
+    </ClInclude>
     <ClInclude Include="..\Include\cpython\tupleobject.h">
       <Filter>Include\cpython</Filter>
     </ClInclude>