Skip to content

Commit

Permalink
bpo-12743: Delete comment from marshal.rst (pythonGH-8457)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
berkerpeksag authored Jul 27, 2018
1 parent 6a62e1d commit defcffd
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions Doc/c-api/marshal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,15 @@ unmarshalling. Version 2 uses a binary format for floating point numbers.
The following functions allow marshalled values to be read back in.
XXX What about error detection? It appears that reading past the end of the
file will always result in a negative numeric value (where that's relevant),
but it's not clear that negative values won't be handled properly when there's
no error. What's the right way to tell? Should only non-negative values be
written using these routines?
.. c:function:: long PyMarshal_ReadLongFromFile(FILE *file)
Return a C :c:type:`long` from the data stream in a :c:type:`FILE\*` opened
for reading. Only a 32-bit value can be read in using this function,
regardless of the native size of :c:type:`long`.
On error, raise an exception and return ``-1``.
On error, sets the appropriate exception (:exc:`EOFError`) and returns
``-1``.
.. c:function:: int PyMarshal_ReadShortFromFile(FILE *file)
Expand All @@ -62,16 +57,17 @@ written using these routines?
for reading. Only a 16-bit value can be read in using this function,
regardless of the native size of :c:type:`short`.
On error, raise an exception and return ``-1``.
On error, sets the appropriate exception (:exc:`EOFError`) and returns
``-1``.
.. c:function:: PyObject* PyMarshal_ReadObjectFromFile(FILE *file)
Return a Python object from the data stream in a :c:type:`FILE\*` opened for
reading.
On error, sets the appropriate exception (:exc:`EOFError` or
:exc:`TypeError`) and returns *NULL*.
On error, sets the appropriate exception (:exc:`EOFError`, :exc:`ValueError`
or :exc:`TypeError`) and returns *NULL*.
.. c:function:: PyObject* PyMarshal_ReadLastObjectFromFile(FILE *file)
Expand All @@ -84,15 +80,15 @@ written using these routines?
file. Only use these variant if you are certain that you won't be reading
anything else from the file.
On error, sets the appropriate exception (:exc:`EOFError` or
:exc:`TypeError`) and returns *NULL*.
On error, sets the appropriate exception (:exc:`EOFError`, :exc:`ValueError`
or :exc:`TypeError`) and returns *NULL*.
.. c:function:: PyObject* PyMarshal_ReadObjectFromString(const char *data, Py_ssize_t len)
Return a Python object from the data stream in a byte buffer
containing *len* bytes pointed to by *data*.
On error, sets the appropriate exception (:exc:`EOFError` or
:exc:`TypeError`) and returns *NULL*.
On error, sets the appropriate exception (:exc:`EOFError`, :exc:`ValueError`
or :exc:`TypeError`) and returns *NULL*.

0 comments on commit defcffd

Please sign in to comment.