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.

classification
Title: zipfile.py -> is_zipfile leaves file open when error
Type: crash Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: eino, ggenellina, pitrou
Priority: normal Keywords:

Created on 2008-10-30 11:52 by eino, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg75368 - (view) Author: Eino Mäkitalo (eino) Date: 2008-10-30 11:52
Very simple error.
If is_zipfile crashes when checking is_zipfile if zipfile is corrupted
or not at all zip. It leaves file open and prevents later to remove file
etc... Maybe it's corrected in next versions

Old code: zipfile...
  line 86:  endrec = _EndRecData(fpin)
  line 87:  fpin.close


My simple corrections to cope with this
        try:
            endrec = _EndRecData(fpin)
        finally:
            fpin.close()
msg78343 - (view) Author: Gabriel Genellina (ggenellina) Date: 2008-12-27 05:45
The patch for issue4756 fixes this too.
msg78367 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-12-27 15:52
Fixed by Gabriel's patch (just committed in trunk and py3k).
History
Date User Action Args
2022-04-11 14:56:40adminsetgithub: 48491
2008-12-27 15:52:05pitrousetstatus: open -> closed
resolution: fixed
messages: + msg78367
nosy: + pitrou
2008-12-27 05:45:56ggenellinasetnosy: + ggenellina
messages: + msg78343
2008-10-30 11:52:02einocreate