[issue36992] zipfile: AttributeError on extract (LZMA)

alter-bug-tracer report at bugs.python.org
Tue May 21 08:29:31 EDT 2019


New submission from alter-bug-tracer <emanuel.vintila at abugtracer.ro>:

The following code throws an AttributeError when attempting to extract a malformed archive (attached):

import zipfile
import sys

zf = zipfile.ZipFile(sys.argv[1])
for info in zf.infolist():
  zf.extract(info.filename)

Result:
Traceback (most recent call last):
  File "code.py", line 6, in <module>
    zf.extract(info.filename)
  File "/usr/local/lib/python3.8/zipfile.py", line 1607, in extract
    return self._extract_member(member, path, pwd)
  File "/usr/local/lib/python3.8/zipfile.py", line 1679, in _extract_member
    shutil.copyfileobj(source, target)
  File "/usr/local/lib/python3.8/shutil.py", line 198, in copyfileobj
    buf = fsrc_read(length)
  File "/usr/local/lib/python3.8/zipfile.py", line 903, in read
    data = self._read1(n)
  File "/usr/local/lib/python3.8/zipfile.py", line 986, in _read1
    data = self._decompressor.decompress(data)
  File "/usr/local/lib/python3.8/zipfile.py", line 635, in decompress
    self._decomp = lzma.LZMADecompressor(lzma.FORMAT_RAW, filters=[
AttributeError: 'NoneType' object has no attribute 'LZMADecompressor'

----------
files: attr1.zip
messages: 343036
nosy: alter-bug-tracer
priority: normal
severity: normal
status: open
title: zipfile: AttributeError on extract (LZMA)
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file48347/attr1.zip

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36992>
_______________________________________


More information about the Python-bugs-list mailing list