diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 0647774f400d69..a45568392fbf9f 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -572,6 +572,12 @@ 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. + (Contributed by Victor Stinner in :issue:`35134`.) + Deprecated ---------- diff --git a/Include/Python.h b/Include/Python.h index dc5c9b8e6384e8..e8e061bdf62e87 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -60,7 +60,7 @@ #include "setobject.h" #include "methodobject.h" #include "moduleobject.h" -#include "funcobject.h" +#include "cpython/funcobject.h" #include "classobject.h" #include "fileobject.h" #include "pycapsule.h" diff --git a/Include/funcobject.h b/Include/cpython/funcobject.h similarity index 99% rename from Include/funcobject.h rename to Include/cpython/funcobject.h index 6bc03f57d4cb39..60b702218a1f40 100644 --- a/Include/funcobject.h +++ b/Include/cpython/funcobject.h @@ -1,5 +1,5 @@ - /* Function object interface */ + #ifndef Py_LIMITED_API #ifndef Py_FUNCOBJECT_H #define Py_FUNCOBJECT_H @@ -76,7 +76,6 @@ PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetAnnotations(PyObject *); PyAPI_FUNC(int) PyFunction_SetAnnotations(PyObject *, PyObject *); -#ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyFunction_Vectorcall( PyObject *func, PyObject *const *stack, @@ -84,7 +83,6 @@ PyAPI_FUNC(PyObject *) _PyFunction_Vectorcall( PyObject *kwnames); uint32_t _PyFunction_GetVersionForCurrentState(PyFunctionObject *func); -#endif /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ diff --git a/Makefile.pre.in b/Makefile.pre.in index 30b025e7efb839..a5585c8de8ad01 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1145,7 +1145,6 @@ PYTHON_HEADERS= \ $(srcdir)/Include/fileutils.h \ $(srcdir)/Include/floatobject.h \ $(srcdir)/Include/frameobject.h \ - $(srcdir)/Include/funcobject.h \ $(srcdir)/Include/genobject.h \ $(srcdir)/Include/import.h \ $(srcdir)/Include/interpreteridobject.h \ @@ -1210,6 +1209,7 @@ PYTHON_HEADERS= \ $(srcdir)/Include/cpython/fileutils.h \ $(srcdir)/Include/cpython/floatobject.h \ $(srcdir)/Include/cpython/frameobject.h \ + $(srcdir)/Include/cpython/funcobject.h \ $(srcdir)/Include/cpython/import.h \ $(srcdir)/Include/cpython/initconfig.h \ $(srcdir)/Include/cpython/interpreteridobject.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 new file mode 100644 index 00000000000000..fc12e02b0c580e --- /dev/null +++ b/Misc/NEWS.d/next/C API/2021-10-15-00-11-51.bpo-35134.eX4zqy.rst @@ -0,0 +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. diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index f688e8a3232451..dc216e34855df2 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -134,6 +134,7 @@ + @@ -169,7 +170,6 @@ - diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters index eb72c38a7b2038..8eeb38871f327e 100644 --- a/PCbuild/pythoncore.vcxproj.filters +++ b/PCbuild/pythoncore.vcxproj.filters @@ -108,9 +108,6 @@ Include - - Include - Include @@ -456,6 +453,9 @@ Include\cpython + + Include\cpython + Include\cpython diff --git a/Tools/scripts/stable_abi.py b/Tools/scripts/stable_abi.py index 6d7034090f8819..6cb310e5a31d5a 100755 --- a/Tools/scripts/stable_abi.py +++ b/Tools/scripts/stable_abi.py @@ -34,7 +34,6 @@ "datetime.h", "dtoa.h", "frameobject.h", - "funcobject.h", "genobject.h", "longintrepr.h", "parsetok.h",