New submission from Peter Bengtsson <m...@peterbe.com>: The ZipFile class as a extractall method [0] that allows you to leave the 'members' empty. If empty, the 'members' becomes a list of all the *names* of files in the zip. Then it iterates over the names as sends each to `self._extract_member`. But that method needs it to be a ZipInfo object instead of a file name, so it re-wraps it [2].
Instead we can use `self.infolist()` to avoid that re-wrapping inside each `self._extract_member` call. [0] hhttps://github.com/python/cpython/blob/12e7cd8a51956a5ce373aac692ae6366c5f86584/Lib/zipfile.py#L1579 [1] https://github.com/python/cpython/blob/12e7cd8a51956a5ce373aac692ae6366c5f86584/Lib/zipfile.py#L1586 [2] https://github.com/python/cpython/blob/12e7cd8a51956a5ce373aac692ae6366c5f86584/Lib/zipfile.py#L1615-L1616 ---------- components: Library (Lib) messages: 311434 nosy: peterbe priority: normal severity: normal status: open title: zipfile extractall needlessly re-wraps ZipInfo instances type: enhancement _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32742> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com