diff options
author | Petr Viktorin <encukou@gmail.com> | 2021-10-20 09:32:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-20 09:32:14 (GMT) |
commit | 98fa3b53e2aecc5ecec64a921bc9cf4f9d07ac75 (patch) | |
tree | d2f4bbd327543ef2801c9830c0c8c686587561b1 | |
parent | 085ccb0f177988065dbe9ef4c5cda434560066bc (diff) | |
download | cpython-98fa3b53e2aecc5ecec64a921bc9cf4f9d07ac75.zip cpython-98fa3b53e2aecc5ecec64a921bc9cf4f9d07ac75.tar.gz cpython-98fa3b53e2aecc5ecec64a921bc9cf4f9d07ac75.tar.bz2 |
bpo-45474: Exclude all of marshal.h if Py_LIMITED_API is defined (GH-29061)
Also, reword the What's New messages: this doesn't change the limited API, it only brings the Py_LIMITED_API macro closer to the ideal of only allowing the limited API.
Automerge-Triggered-By: GH:encukou
-rw-r--r-- | Doc/whatsnew/3.11.rst | 9 | ||||
-rw-r--r-- | Include/marshal.h | 6 | ||||
-rw-r--r-- | Misc/NEWS.d/next/C API/2021-10-14-22-16-56.bpo-45474.1OkJQh.rst | 9 |
3 files changed, 15 insertions, 9 deletions
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index b583c2f..13c1e72 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -627,14 +627,17 @@ Removed ``Py_IS_INFINITY()`` macro. (Contributed by Victor Stinner in :issue:`45440`.) -* Remove two functions from the limited C API: +* The following items are no longer available when :c:macro:`Py_LIMITED_API` + is defined: * :c:func:`PyMarshal_WriteLongToFile` * :c:func:`PyMarshal_WriteObjectToFile` + * :c:func:`PyMarshal_ReadObjectFromString` + * :c:func:`PyMarshal_WriteObjectToString` + * the ``Py_MARSHAL_VERSION`` macro - The :pep:`384` excludes functions expecting ``FILE*`` from the stable ABI. + These are not part of the :ref:`limited API <stable-abi-list>`. - Remove also the ``Py_MARSHAL_VERSION`` macro from the limited C API. (Contributed by Victor Stinner in :issue:`45474`.) * Exclude :c:func:`PyWeakref_GET_OBJECT` from the limited C API. It never diff --git a/Include/marshal.h b/Include/marshal.h index 36ef6a7..f8b0de8 100644 --- a/Include/marshal.h +++ b/Include/marshal.h @@ -3,6 +3,8 @@ #ifndef Py_MARSHAL_H #define Py_MARSHAL_H +#ifndef Py_LIMITED_API + #ifdef __cplusplus extern "C" { #endif @@ -11,7 +13,6 @@ PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(const char *, Py_ssize_t); PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *, int); -#ifndef Py_LIMITED_API #define Py_MARSHAL_VERSION 4 PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE *); @@ -21,9 +22,10 @@ PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *); PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int); PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int); -#endif #ifdef __cplusplus } #endif + +#endif /* Py_LIMITED_API */ #endif /* !Py_MARSHAL_H */ diff --git a/Misc/NEWS.d/next/C API/2021-10-14-22-16-56.bpo-45474.1OkJQh.rst b/Misc/NEWS.d/next/C API/2021-10-14-22-16-56.bpo-45474.1OkJQh.rst index 90bf498..d41f1b7 100644 --- a/Misc/NEWS.d/next/C API/2021-10-14-22-16-56.bpo-45474.1OkJQh.rst +++ b/Misc/NEWS.d/next/C API/2021-10-14-22-16-56.bpo-45474.1OkJQh.rst @@ -1,10 +1,11 @@ -Remove two functions from the limited C API: +The following items are no longer available when ``Py_LIMITED_API`` is defined: * :c:func:`PyMarshal_WriteLongToFile` * :c:func:`PyMarshal_WriteObjectToFile` +* :c:func:`PyMarshal_ReadObjectFromString` +* :c:func:`PyMarshal_WriteObjectToString` +* the ``Py_MARSHAL_VERSION`` macro -The :pep:`384` excludes functions expecting ``FILE*`` from the stable ABI. - -Remove also the ``Py_MARSHAL_VERSION`` macro from the limited C API. +These are not part of the :ref:`limited API <stable-abi-list>`. Patch by Victor Stinner. |