Andrei Kulakov <andrei....@gmail.com> added the comment:
In my testing on 3.9.1 and the current `main` branch, I found: - I can reproduce this issue if a function or a lambda or class with a method are defined. - There is no error if a class is defined with no methods. (I'm not sure why). The test code runs without errors if the following check is done before seeking the `fp` in `close()`: if not self.fp.closed: here: https://github.com/python/cpython/blob/main/Lib/zipfile.py#L1823 The fix also requires adding `closed` property to `zipfile._Tellable` With these two small changes, all test_zipfile tests pass. I'm not sure this is the proper fix, because this is a complex issue.. I will go ahead and put up a PR if this seems like a good approach. ---------- nosy: +andrei.avk _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37773> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com