[Python-checkins] bpo-12743: Delete comment from marshal.rst (GH-8457)

Miss Islington (bot) webhook-mailer at python.org
Fri Jul 27 00:42:48 EDT 2018


https://github.com/python/cpython/commit/146ba436cc0457b8ef7fea8b054b9ccb15e24748
commit: 146ba436cc0457b8ef7fea8b054b9ccb15e24748
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018年07月26日T21:42:44-07:00
summary:
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.
(cherry picked from commit defcffdf86780e3a184ebb25dc9a7b807753d57a)
Co-authored-by: Berker Peksag <berker.peksag at gmail.com>
files:
M Doc/c-api/marshal.rst
diff --git a/Doc/c-api/marshal.rst b/Doc/c-api/marshal.rst
index c6d1d02a2fa5..17ec621610b5 100644
--- a/Doc/c-api/marshal.rst
+++ b/Doc/c-api/marshal.rst
@@ -40,12 +40,6 @@ 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)
 
@@ -53,7 +47,8 @@ written using these routines?
 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)
@@ -62,7 +57,8 @@ 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)
@@ -70,8 +66,8 @@ written using these routines?
 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)
@@ -84,8 +80,8 @@ 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)
@@ -93,6 +89,6 @@ written using these routines?
 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*.
 


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /