This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ultimalium
Recipients ultimalium
Date 2022-03-05.17:37:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1646501853.93.0.304321203932.issue46931@roundup.psfhosted.org>
In-reply-to
Content
I intentionally made some corrupted zip archive files for testing.
If some contents were removed from the archive instead of changing the bits. when trying to read such files, the zipfile will raise an uncaught  OSError, instead of a badzipfile error as expected.

os is windows 10 x64 not sure if this also happens on the UNIX system or it's intended to be happen.

code:

import zipfile
with zipfile.ZipFile(r'damaged.zip') as dmg:
    dmg.testzip()

result:
OSError
[Errno 22] Invalid argument
  File "test.py", line 20, in <module>
    file = dmg.testzip()
History
Date User Action Args
2022-03-05 17:37:33ultimaliumsetrecipients: + ultimalium
2022-03-05 17:37:33ultimaliumsetmessageid: <1646501853.93.0.304321203932.issue46931@roundup.psfhosted.org>
2022-03-05 17:37:33ultimaliumlinkissue46931 messages
2022-03-05 17:37:33ultimaliumcreate