https://github.com/python/cpython/commit/85ec35d2ab8b764aefd6810efd59ff54c92554e9
commit: 85ec35d2ab8b764aefd6810efd59ff54c92554e9
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2025-10-08T01:19:50+02:00
summary:
gh-79315: Add Include/cpython/structseq.h header (#139730)
files:
A Include/cpython/structseq.h
M Include/structseq.h
M Makefile.pre.in
M PCbuild/pythoncore.vcxproj
M PCbuild/pythoncore.vcxproj.filters
diff --git a/Include/cpython/structseq.h b/Include/cpython/structseq.h
new file mode 100644
index 00000000000000..328fbe86143b02
--- /dev/null
+++ b/Include/cpython/structseq.h
@@ -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
diff --git a/Include/structseq.h b/Include/structseq.h
index 29e24fee54e613..e52d6188030af9 100644
--- a/Include/structseq.h
+++ b/Include/structseq.h
@@ -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
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 061305a9ed11a7..987d55a9bdbd3b 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -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 \
diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
index 248b63f25775da..71f508a7e8b5fb 100644
--- a/PCbuild/pythoncore.vcxproj
+++ b/PCbuild/pythoncore.vcxproj
@@ -193,6 +193,7 @@
<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" />
diff --git a/PCbuild/pythoncore.vcxproj.filters
b/PCbuild/pythoncore.vcxproj.filters
index da07a139b7c93d..547e9ee1abf370 100644
--- a/PCbuild/pythoncore.vcxproj.filters
+++ b/PCbuild/pythoncore.vcxproj.filters
@@ -486,6 +486,9 @@
<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>
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]