Author ezio.melotti
Recipients christian.heimes, ezio.melotti, felipecruz, jcea, pitrou
Date 2012-09-15.05:10:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1347685812.59.0.276096036472.issue15897@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2012-09-15 05:10:12ezio.melottisetrecipients: + ezio.melotti, jcea, pitrou, christian.heimes, felipecruz
2012-09-15 05:10:12ezio.melottisetmessageid: <1347685812.59.0.276096036472.issue15897@psf.upfronthosting.co.za>
2012-09-15 05:10:12ezio.melottilinkissue15897 messages
2012-09-15 05:10:10ezio.melotticreate