Felix C. Stegerman <f...@obfusk.net> added the comment:
I've closed the PR for now. Using a carefully crafted ZipInfo object doesn't work because ZipFile modifies its .external_attr when set to 0. Using something like this quickly hacked together ZipInfo subclass does work: class ZeroedZipInfo(zipfile.ZipInfo): def __init__(self, zinfo): for k in self.__slots__: setattr(self, k, getattr(zinfo, k)) def __getattribute__(self, name): if name == "date_time": return (1980,0,0,0,0,0) if name == "external_attr": return 0 return object.__getattribute__(self, name) ... myzipfile.writestr(ZeroedZipInfo(info), data) ---------- components: +IO type: enhancement -> versions: +Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43547> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com