diff options
Diffstat (limited to 'qutebrowser/components/hostblock.py')
-rw-r--r-- | qutebrowser/components/hostblock.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/qutebrowser/components/hostblock.py b/qutebrowser/components/hostblock.py index 1860b734c..191719f10 100644 --- a/qutebrowser/components/hostblock.py +++ b/qutebrowser/components/hostblock.py @@ -64,9 +64,10 @@ def get_fileobj(byte_io: IO[bytes]) -> IO[bytes]: byte_io.seek(0) # rewind downloaded file if zipfile.is_zipfile(byte_io): byte_io.seek(0) # rewind what zipfile.is_zipfile did - zf = zipfile.ZipFile(byte_io) - filename = _guess_zip_filename(zf) - byte_io = zf.open(filename, mode="r") + with zipfile.ZipFile(byte_io) as zf: + filename = _guess_zip_filename(zf) + # pylint: disable=consider-using-with + byte_io = zf.open(filename, mode="r") else: byte_io.seek(0) # rewind what zipfile.is_zipfile did return byte_io |