Ezio Melotti added the comment: I suggested to Felipe on IRC to use "read" instead of "seek" because I don't think it's worth making a distinction between the two. Moreover ISTM that in most of the cases, if the fseek fails, the error is detected in a following fread, so the message currently says "can't read", and changing it to "can't seek" is technically backward-incompatible.
We also checked if the test suite followed any of these new error paths, but apparently only the "if" added in the first chunk (line 880, in read_directory) is already covered. Going through the following chunks (the ones with the goto fseek_error) is fairly difficult. It should be possibly to trigger the error at line 1071, in get_data, by changing the value of self.archive, but alas self.archive is read-only. The error generated by PyErr_SetFromErrno() doesn't seem too useful. For example, with "PyErr_SetFromErrno(PyExc_IOError);" instead of "PyErr_Format(ZipImportError, "can't open Zip file: %R", archive);", the error becomes "OSError: [Errno 22] Invalid argument". This alone is fairly useless, even though the message might be better in other situations. I think either using PyErr_Format, or a combination of the two (something like "ZipImportError: can't read Zip file: 'ziptestmodule' ([Errno 22] Invalid argument)") would be better. ---------- keywords: -easy nosy: +ezio.melotti, pitrou stage: -> patch review _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15897> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com