Skip to content

Commit af1083e

Browse files
authored
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.
1 parent 0a883a7 commit af1083e

3 files changed

Lines changed: 27 additions & 6 deletions

File tree

Doc/whatsnew/3.11.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,3 +613,13 @@ Removed
613613
* Remove the ``Py_FORCE_DOUBLE()`` macro. It was used by the
614614
``Py_IS_INFINITY()`` macro.
615615
(Contributed by Victor Stinner in :issue:`45440`.)
616+
617+
* Remove two functions from the limited C API:
618+
619+
* :c:func:`PyMarshal_WriteLongToFile`
620+
* :c:func:`PyMarshal_WriteObjectToFile`
621+
622+
The :pep:`384` excludes functions expecting ``FILE*`` from the stable ABI.
623+
624+
Remove also the ``Py_MARSHAL_VERSION`` macro from the limited C API.
625+
(Contributed by Victor Stinner in :issue:`45474`.)

Include/marshal.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@
77
extern "C" {
88
#endif
99

10-
#define Py_MARSHAL_VERSION 4
11-
12-
PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int);
13-
PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int);
10+
PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(const char *,
11+
Py_ssize_t);
1412
PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *, int);
1513

1614
#ifndef Py_LIMITED_API
15+
#define Py_MARSHAL_VERSION 4
16+
1717
PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE *);
1818
PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE *);
1919
PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *);
2020
PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *);
21+
22+
PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int);
23+
PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int);
2124
#endif
22-
PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(const char *,
23-
Py_ssize_t);
2425

2526
#ifdef __cplusplus
2627
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Remove two functions from the limited C API:
2+
3+
* :c:func:`PyMarshal_WriteLongToFile`
4+
* :c:func:`PyMarshal_WriteObjectToFile`
5+
6+
The :pep:`384` excludes functions expecting ``FILE*`` from the stable ABI.
7+
8+
Remove also the ``Py_MARSHAL_VERSION`` macro from the limited C API.
9+
10+
Patch by Victor Stinner.

0 commit comments

Comments
 (0)