Message191116
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. |
|
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 | |
|