Message191116
| Author |
ronaldoussoren |
| Recipients |
JJeffries, docs@python, eric.araujo, loewis, ronaldoussoren |
| Date |
2013年06月14日.11:08:34 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1371208114.59.0.477225283094.issue12743@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
From reading the source of Python/marshal.c it seems that the read function's raise an exception on I/O errors, but don't return a specific value (that is, sentence starting with "It appears that" is wrong).
PyMarshal_ReadLongFromFile calls r_long, this calls r_string without checking for errors and calculates the return value from the buffer passed to r_string. On I/O errors the buffer may not have been filled at all and contains random data (whatever happened to be on the stack).
Likewise for PyMarhal_ReadShortFromFile (through r_short instead of r_long).
r_string does raise an exception on I/O errors or short reads, but reading from FILE* and Python objects.
The most straightforward documentation update would be:
* Remove the entire XXX paragraph
* Add text to the documentation for PyMarshal_ReadLongFromFile and PyMarshal_ReadShortFromFile: On error sets the appopriate exception (:exc:`EOFError`), but does not return a specific value. Use :func:`PyErr_Occurred` to check for errors. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2013年06月14日 11:08:34 | ronaldoussoren | set | recipients:
+ ronaldoussoren, loewis, eric.araujo, docs@python, JJeffries |
| 2013年06月14日 11:08:34 | ronaldoussoren | set | messageid: <1371208114.59.0.477225283094.issue12743@psf.upfronthosting.co.za> |
| 2013年06月14日 11:08:34 | ronaldoussoren | link | issue12743 messages |
| 2013年06月14日 11:08:34 | ronaldoussoren | create |
|