diff options
author | Victor Stinner <vstinner@python.org> | 2021-10-14 22:20:33 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-14 22:20:33 (GMT) |
commit | af1083e975b9627a5c97013d3a2b9aef0e4b333c (patch) | |
tree | 065625bdac161b18912ec7ef005692d61117cd04 | |
parent | 0a883a76cda8205023c52211968bcf87bd47fd6e (diff) | |
download | cpython-af1083e975b9627a5c97013d3a2b9aef0e4b333c.zip cpython-af1083e975b9627a5c97013d3a2b9aef0e4b333c.tar.gz cpython-af1083e975b9627a5c97013d3a2b9aef0e4b333c.tar.bz2 |
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.
-rw-r--r-- | Doc/whatsnew/3.11.rst | 10 | ||||
-rw-r--r-- | Include/marshal.h | 13 | ||||
-rw-r--r-- | Misc/NEWS.d/next/C API/2021-10-14-22-16-56.bpo-45474.1OkJQh.rst | 10 |
3 files changed, 27 insertions, 6 deletions
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 48d454d..e8d64a8 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -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`.) diff --git a/Include/marshal.h b/Include/marshal.h index 09d9337..36ef6a7 100644 --- a/Include/marshal.h +++ b/Include/marshal.h @@ -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 index 0000000..90bf498 --- /dev/null +++ b/Misc/NEWS.d/next/C API/2021-10-14-22-16-56.bpo-45474.1OkJQh.rst @@ -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. |