[issue40564] Using zipfile.Path with several files prematurely closes zip

Jason R. Coombs report at bugs.python.org
Tue Sep 22 10:09:07 EDT 2020


Jason R. Coombs <jaraco at jaraco.com> added the comment:

I've also created this alternative to option 2:

- https://github.com/jaraco/zipp/tree/bugfix/bpo-40564-mixin

This alternative approach uses a mix-in rather than subclasses, creating a new class on-demand. I was hoping this approach would enable just augmenting the instance rather than affecting `source.__class__`, but when I got to the implementation, I found that `source.__class__` had to be mutated regardless.

This approach does have an advantage over option 2 in that it would support other ZipFile subclasses for source. It has the disadvantage in that it creates a new subclass for every instance created.

I've thought about it a lot and while I'm not particularly happy with any of the approaches, I'm leaning toward option 2.

----------

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


More information about the Python-bugs-list mailing list