]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45474: Fix the limited C API of marshal.h (GH-28956)
authorVictor Stinner <vstinner@python.org>
Thu, 14 Oct 2021 22:20:33 +0000 (00:20 +0200)
committerGitHub <noreply@github.com>
Thu, 14 Oct 2021 22:20:33 +0000 (00:20 +0200)
Remove two functions from the limited C API:

* PyMarshal_WriteLongToFile()
* PyMarshal_WriteObjectToFile()

The PEP 384 excludes functions expecting "FILE*" from the stable ABI.

Remove also the Py_MARSHAL_VERSION macro from the limited C API.

Doc/whatsnew/3.11.rst
Include/marshal.h
Misc/NEWS.d/next/C API/2021-10-14-22-16-56.bpo-45474.1OkJQh.rst [new file with mode: 0644]

index 48d454d9aac99fe310d2432647c9ed968442dbbd..e8d64a80a69a36aaa54347afa01593db579f4e33 100644 (file)
@@ -613,3 +613,13 @@ Removed
 * Remove the ``Py_FORCE_DOUBLE()`` macro. It was used by the
   ``Py_IS_INFINITY()`` macro.
   (Contributed by Victor Stinner in :issue:`45440`.)
+
+* Remove two functions from the limited C API:
+
+  * :c:func:`PyMarshal_WriteLongToFile`
+  * :c:func:`PyMarshal_WriteObjectToFile`
+
+  The :pep:`384` excludes functions expecting ``FILE*`` from the stable ABI.
+
+  Remove also the ``Py_MARSHAL_VERSION`` macro from the limited C API.
+  (Contributed by Victor Stinner in :issue:`45474`.)
index 09d9337e57b0aa3ca18ba4a64bc360f8661ec080..36ef6a779ec2c6c65785543de846f275b8d962a6 100644 (file)
@@ -7,20 +7,21 @@
 extern "C" {
 #endif
 
-#define Py_MARSHAL_VERSION 4
-
-PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int);
-PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int);
+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 *);
 PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE *);
 PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *);
 PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *);
+
+PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int);
+PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int);
 #endif
-PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(const char *,
-                                                      Py_ssize_t);
 
 #ifdef __cplusplus
 }
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
new file mode 100644 (file)
index 0000000..90bf498
--- /dev/null
@@ -0,0 +1,10 @@
+Remove two functions from the limited C API:
+
+* :c:func:`PyMarshal_WriteLongToFile`
+* :c:func:`PyMarshal_WriteObjectToFile`
+
+The :pep:`384` excludes functions expecting ``FILE*`` from the stable ABI.
+
+Remove also the ``Py_MARSHAL_VERSION`` macro from the limited C API.
+
+Patch by Victor Stinner.