]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45474: Exclude all of marshal.h if Py_LIMITED_API is defined (GH-29061)
authorPetr Viktorin <encukou@gmail.com>
Wed, 20 Oct 2021 09:32:14 +0000 (11:32 +0200)
committerGitHub <noreply@github.com>
Wed, 20 Oct 2021 09:32:14 +0000 (02:32 -0700)
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
Doc/whatsnew/3.11.rst
Include/marshal.h
Misc/NEWS.d/next/C API/2021-10-14-22-16-56.bpo-45474.1OkJQh.rst

index b583c2f31c4cc36a6ead9c7ccda329322121bd5f..13c1e72306653e5f7f7f33d6c5ff2eeb7d7125c6 100644 (file)
@@ -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
index 36ef6a779ec2c6c65785543de846f275b8d962a6..f8b0de80cfc38df628992918fc1e6cd19cdf4a6b 100644 (file)
@@ -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 */
index 90bf498579c11a133b801b0f738ce5102338c1dd..d41f1b72b8966f5e342fcef3a69680eee6e82bd8 100644 (file)
@@ -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.