bpo-45474: Fix the limited C API of marshal.h (GH-28956)

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.
This commit is contained in:
Victor Stinner 2021-10-15 00:20:33 +02:00 committed by GitHub
parent 0a883a76cd
commit af1083e975
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 6 deletions

View 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`.)

View 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
}

View File

@ -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.