From c2931d31f8ba7cf10044de276018c713ffc73592 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Mon, 3 May 2021 15:50:24 +0100 Subject: bpo-43916: Move the _PyStructSequence_InitType function to the internal API (GH-25854) --- Doc/data/stable_abi.dat | 1 - Include/internal/pycore_structseq.h | 21 +++++++++++++++++++++ Include/structseq.h | 4 ---- Makefile.pre.in | 1 + Misc/stable_abi.txt | 2 -- Modules/_cursesmodule.c | 2 +- Objects/structseq.c | 1 + PC/python3dll.c | 1 - PCbuild/pythoncore.vcxproj | 1 + Python/sysmodule.c | 1 + 10 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 Include/internal/pycore_structseq.h diff --git a/Doc/data/stable_abi.dat b/Doc/data/stable_abi.dat index b21374a..833228f 100644 --- a/Doc/data/stable_abi.dat +++ b/Doc/data/stable_abi.dat @@ -918,7 +918,6 @@ Py_tp_setattro Py_tp_str Py_tp_traverse Py_uintptr_t -_PyStructSequence_InitType _frame _node allocfunc diff --git a/Include/internal/pycore_structseq.h b/Include/internal/pycore_structseq.h new file mode 100644 index 0000000..84c8d47 --- /dev/null +++ b/Include/internal/pycore_structseq.h @@ -0,0 +1,21 @@ +#ifndef Py_INTERNAL_STRUCTSEQ_H +#define Py_INTERNAL_STRUCTSEQ_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + + +PyAPI_FUNC(int) _PyStructSequence_InitType( + PyTypeObject *type, + PyStructSequence_Desc *desc, + unsigned long tp_flags); + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_STRUCTSEQ_H */ diff --git a/Include/structseq.h b/Include/structseq.h index 890e031..8f51c89 100644 --- a/Include/structseq.h +++ b/Include/structseq.h @@ -27,10 +27,6 @@ PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type, PyAPI_FUNC(int) PyStructSequence_InitType2(PyTypeObject *type, PyStructSequence_Desc *desc); #endif -PyAPI_FUNC(int) _PyStructSequence_InitType( - PyTypeObject *type, - PyStructSequence_Desc *desc, - unsigned long tp_flags); PyAPI_FUNC(PyTypeObject*) PyStructSequence_NewType(PyStructSequence_Desc *desc); PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type); diff --git a/Makefile.pre.in b/Makefile.pre.in index 0836655..92cc486 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1171,6 +1171,7 @@ PYTHON_HEADERS= \ $(srcdir)/Include/internal/pycore_pymem.h \ $(srcdir)/Include/internal/pycore_pystate.h \ $(srcdir)/Include/internal/pycore_runtime.h \ + $(srcdir)/Include/internal/pycore_structseq.h \ $(srcdir)/Include/internal/pycore_symtable.h \ $(srcdir)/Include/internal/pycore_sysmodule.h \ $(srcdir)/Include/internal/pycore_traceback.h \ diff --git a/Misc/stable_abi.txt b/Misc/stable_abi.txt index d79746e..2a802bd 100644 --- a/Misc/stable_abi.txt +++ b/Misc/stable_abi.txt @@ -2121,8 +2121,6 @@ function PyObject_GetAiter added 3.10 data PyExc_EncodingWarning added 3.10 -function _PyStructSequence_InitType - added 3.10 # Support for Stable ABI in debug builds diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index bcf9ad1..b6b7ca4 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -104,7 +104,7 @@ static const char PyCursesVersion[] = "2.2"; #include "Python.h" #include "pycore_long.h" // _PyLong_GetZero() - +#include "pycore_structseq.h" // PyStructSequence_InitType() #ifdef __hpux #define STRICT_SYSV_CURSES diff --git a/Objects/structseq.c b/Objects/structseq.c index bf59f47..73795b6 100644 --- a/Objects/structseq.c +++ b/Objects/structseq.c @@ -11,6 +11,7 @@ #include "pycore_tuple.h" // _PyTuple_FromArray() #include "pycore_object.h" // _PyObject_GC_TRACK() #include "structmember.h" // PyMemberDef +#include "pycore_structseq.h" // PyStructSequence_InitType() static const char visible_length_key[] = "n_sequence_fields"; static const char real_length_key[] = "n_fields"; diff --git a/PC/python3dll.c b/PC/python3dll.c index 30868c1..574d4dc 100755 --- a/PC/python3dll.c +++ b/PC/python3dll.c @@ -35,7 +35,6 @@ EXPORT_FUNC(_PyObject_GC_Resize) EXPORT_FUNC(_PyObject_New) EXPORT_FUNC(_PyObject_NewVar) EXPORT_FUNC(_PyState_AddModule) -EXPORT_FUNC(_PyStructSequence_InitType) EXPORT_FUNC(_PyThreadState_Init) EXPORT_FUNC(_PyThreadState_Prealloc) EXPORT_FUNC(_PyTrash_deposit_object) diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 429d437..0382977 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -209,6 +209,7 @@ + diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 2190bbf..ac49f78 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -24,6 +24,7 @@ Data members: #include "pycore_pymem.h" // _PyMem_SetDefaultAllocator() #include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_tuple.h" // _PyTuple_FromArray() +#include "pycore_structseq.h" // PyStructSequence_InitType() #include "code.h" #include "frameobject.h" // PyFrame_GetBack() -- cgit v0.12