[New-bugs-announce] [issue4241] zipfile.py -> is_zipfile leaves file open when error

Eino Mäkitalo report at bugs.python.org
Thu Oct 30 12:52:05 CET 2008


New submission from Eino Mäkitalo <eino.makitalo at netitbe.fi>:

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()

----------
components: Library (Lib)
messages: 75368
nosy: eino
severity: normal
status: open
title: zipfile.py -> is_zipfile leaves file open when error
type: crash
versions: Python 2.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4241>
_______________________________________


More information about the New-bugs-announce mailing list