From 77b24ba505744532d7cfd721b1c92d205e145180 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 15 Oct 2021 02:39:58 +0200 Subject: bpo-35134: Move Include/cellobject.h to Include/cpython/ (GH-28964) --- Doc/whatsnew/3.11.rst | 9 ++++--- Include/Python.h | 2 +- Include/cellobject.h | 29 -------------------- Include/cpython/cellobject.h | 31 ++++++++++++++++++++++ Makefile.pre.in | 2 +- .../C API/2021-10-15-00-11-51.bpo-35134.eX4zqy.rst | 6 ++--- PCbuild/pythoncore.vcxproj | 2 +- PCbuild/pythoncore.vcxproj.filters | 6 ++--- 8 files changed, 45 insertions(+), 42 deletions(-) delete mode 100644 Include/cellobject.h create mode 100644 Include/cpython/cellobject.h diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index a455683..734cf15 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -572,10 +572,11 @@ Porting to Python 3.11 header provides functions like ``printf()`` and ``fopen()``. (Contributed by Victor Stinner in :issue:`45434`.) -* The non-limited API file ``funcobject.h`` has been moved to the - ``Include/cpython`` directory. This file must not be included directly, as it - is already included in ``Python.h``: :ref:`Include Files `. If - it has been included directly, consider including ``Python.h`` instead. +* The non-limited API files ``cellobject.h`` and ``funcobject.h`` have been + moved to the ``Include/cpython`` directory. These files must not be included + directly, as they are already included in ``Python.h``: :ref:`Include Files + `. If they have been included directly, consider including + ``Python.h`` instead. (Contributed by Victor Stinner in :issue:`35134`.) Deprecated diff --git a/Include/Python.h b/Include/Python.h index e8e061b..89f60fe 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -68,7 +68,7 @@ #include "pyframe.h" #include "traceback.h" #include "sliceobject.h" -#include "cellobject.h" +#include "cpython/cellobject.h" #include "iterobject.h" #include "genobject.h" #include "descrobject.h" diff --git a/Include/cellobject.h b/Include/cellobject.h deleted file mode 100644 index 81bc784..0000000 --- a/Include/cellobject.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Cell object interface */ -#ifndef Py_LIMITED_API -#ifndef Py_CELLOBJECT_H -#define Py_CELLOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - PyObject_HEAD - PyObject *ob_ref; /* Content of the cell or NULL when empty */ -} PyCellObject; - -PyAPI_DATA(PyTypeObject) PyCell_Type; - -#define PyCell_Check(op) Py_IS_TYPE(op, &PyCell_Type) - -PyAPI_FUNC(PyObject *) PyCell_New(PyObject *); -PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *); -PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *); - -#define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref) -#define PyCell_SET(op, v) ((void)(((PyCellObject *)(op))->ob_ref = v)) - -#ifdef __cplusplus -} -#endif -#endif /* !Py_TUPLEOBJECT_H */ -#endif /* Py_LIMITED_API */ diff --git a/Include/cpython/cellobject.h b/Include/cpython/cellobject.h new file mode 100644 index 0000000..8dc7b8f --- /dev/null +++ b/Include/cpython/cellobject.h @@ -0,0 +1,31 @@ +/* Cell object interface */ + +#ifndef Py_LIMITED_API +#ifndef Py_CELLOBJECT_H +#define Py_CELLOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + PyObject_HEAD + /* Content of the cell or NULL when empty */ + PyObject *ob_ref; +} PyCellObject; + +PyAPI_DATA(PyTypeObject) PyCell_Type; + +#define PyCell_Check(op) Py_IS_TYPE(op, &PyCell_Type) + +PyAPI_FUNC(PyObject *) PyCell_New(PyObject *); +PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *); +PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *); + +#define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref) +#define PyCell_SET(op, v) ((void)(((PyCellObject *)(op))->ob_ref = v)) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_TUPLEOBJECT_H */ +#endif /* Py_LIMITED_API */ diff --git a/Makefile.pre.in b/Makefile.pre.in index a5585c8..32bbab0 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1127,7 +1127,6 @@ PYTHON_HEADERS= \ $(srcdir)/Include/boolobject.h \ $(srcdir)/Include/bytearrayobject.h \ $(srcdir)/Include/bytesobject.h \ - $(srcdir)/Include/cellobject.h \ $(srcdir)/Include/ceval.h \ $(srcdir)/Include/classobject.h \ $(srcdir)/Include/code.h \ @@ -1201,6 +1200,7 @@ PYTHON_HEADERS= \ $(srcdir)/Include/cpython/abstract.h \ $(srcdir)/Include/cpython/bytearrayobject.h \ $(srcdir)/Include/cpython/bytesobject.h \ + $(srcdir)/Include/cpython/cellobject.h \ $(srcdir)/Include/cpython/ceval.h \ $(srcdir)/Include/cpython/code.h \ $(srcdir)/Include/cpython/compile.h \ diff --git a/Misc/NEWS.d/next/C API/2021-10-15-00-11-51.bpo-35134.eX4zqy.rst b/Misc/NEWS.d/next/C API/2021-10-15-00-11-51.bpo-35134.eX4zqy.rst index fc12e02..800f6e7 100644 --- a/Misc/NEWS.d/next/C API/2021-10-15-00-11-51.bpo-35134.eX4zqy.rst +++ b/Misc/NEWS.d/next/C API/2021-10-15-00-11-51.bpo-35134.eX4zqy.rst @@ -1,3 +1,3 @@ -Move Include/funcobject.h header file to Include/cpython/funcobject.h. -C extensions should only include the main ```` header. -Patch by Victor Stinner. +Move ``cellobject.h`` and ``funcobject.h`` header files from ``Include/`` to +``Include/cpython/``. C extensions should only include the main ```` +header. Patch by Victor Stinner. diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index dc216e3..877064e 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -115,7 +115,6 @@ - @@ -126,6 +125,7 @@ + diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters index 8eeb388..b8841c9 100644 --- a/PCbuild/pythoncore.vcxproj.filters +++ b/PCbuild/pythoncore.vcxproj.filters @@ -51,9 +51,6 @@ Include - - Include - Include @@ -372,6 +369,9 @@ Include\cpython + + Include\cpython + Include\cpython -- cgit v0.12