Skip to content

Commit defcffd

Browse files
authored
bpo-12743: Delete comment from marshal.rst (GH-8457)
Also, update the list of exceptions that may raised by PyMarshal_* functions. We usually don't document exceptions raised by a function, but in this case most of them were already documented in C API and standard library documentation.
1 parent 6a62e1d commit defcffd

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

Doc/c-api/marshal.rst

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,15 @@ unmarshalling. Version 2 uses a binary format for floating point numbers.
4040
4141
The following functions allow marshalled values to be read back in.
4242
43-
XXX What about error detection? It appears that reading past the end of the
44-
file will always result in a negative numeric value (where that's relevant),
45-
but it's not clear that negative values won't be handled properly when there's
46-
no error. What's the right way to tell? Should only non-negative values be
47-
written using these routines?
48-
4943
5044
.. c:function:: long PyMarshal_ReadLongFromFile(FILE *file)
5145
5246
Return a C :c:type:`long` from the data stream in a :c:type:`FILE\*` opened
5347
for reading. Only a 32-bit value can be read in using this function,
5448
regardless of the native size of :c:type:`long`.
5549
56-
On error, raise an exception and return ``-1``.
50+
On error, sets the appropriate exception (:exc:`EOFError`) and returns
51+
``-1``.
5752
5853
5954
.. c:function:: int PyMarshal_ReadShortFromFile(FILE *file)
@@ -62,16 +57,17 @@ written using these routines?
6257
for reading. Only a 16-bit value can be read in using this function,
6358
regardless of the native size of :c:type:`short`.
6459
65-
On error, raise an exception and return ``-1``.
60+
On error, sets the appropriate exception (:exc:`EOFError`) and returns
61+
``-1``.
6662
6763
6864
.. c:function:: PyObject* PyMarshal_ReadObjectFromFile(FILE *file)
6965
7066
Return a Python object from the data stream in a :c:type:`FILE\*` opened for
7167
reading.
7268
73-
On error, sets the appropriate exception (:exc:`EOFError` or
74-
:exc:`TypeError`) and returns *NULL*.
69+
On error, sets the appropriate exception (:exc:`EOFError`, :exc:`ValueError`
70+
or :exc:`TypeError`) and returns *NULL*.
7571
7672
7773
.. c:function:: PyObject* PyMarshal_ReadLastObjectFromFile(FILE *file)
@@ -84,15 +80,15 @@ written using these routines?
8480
file. Only use these variant if you are certain that you won't be reading
8581
anything else from the file.
8682
87-
On error, sets the appropriate exception (:exc:`EOFError` or
88-
:exc:`TypeError`) and returns *NULL*.
83+
On error, sets the appropriate exception (:exc:`EOFError`, :exc:`ValueError`
84+
or :exc:`TypeError`) and returns *NULL*.
8985
9086
9187
.. c:function:: PyObject* PyMarshal_ReadObjectFromString(const char *data, Py_ssize_t len)
9288
9389
Return a Python object from the data stream in a byte buffer
9490
containing *len* bytes pointed to by *data*.
9591
96-
On error, sets the appropriate exception (:exc:`EOFError` or
97-
:exc:`TypeError`) and returns *NULL*.
92+
On error, sets the appropriate exception (:exc:`EOFError`, :exc:`ValueError`
93+
or :exc:`TypeError`) and returns *NULL*.
9894

0 commit comments

Comments
 (0)