Title: zipfile.Path should support inheritance
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.10
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: conchylicultor, jaraco, python-dev
Priority: normal Keywords: patch

Created on 2020-10-15 12:03 by conchylicultor, last changed 2020-10-15 21:25 by jaraco.

Pull Requests
URL Status Linked Edit
PR 22711 closed python-dev, 2020-10-15 12:07
PR 22716 open jaraco, 2020-10-15 21:25
Messages (2)
msg378678 - (view) Author: conchylicultor (conchylicultor) * Date: 2020-10-15 12:03
Currently, zipfile.Path inheritance behavior is inconsistent with pathlib.Path:

class MyPath(zipfile.Path):

path = MyPath(zf)
path = path.joinpath('other')
assert isinstance(path, MyPath)  # Oups, type(path) is zipfile.Path

Calling parent, /,... should keep the class, as for pathlib.Path

Use case: I'm writing a wrapper around `zipfile.Path` which adds `os.fspath` compatibility (the file is extracted in a tmp dir when os.path.join, open,...).
msg378695 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2020-10-15 19:44
This issue was addressed incidentally in [jaraco/zipp#56]( released as zipp 3.2.0.

I'd like to incorporate the tests submitted in PR 22711 and then port those changes to Python.
Date User Action Args
2020-10-15 21:25:53jaracosetpull_requests: + pull_request21684
2020-10-15 19:44:02jaracosetmessages: + msg378695
2020-10-15 13:39:59xtreaksetnosy: + jaraco
2020-10-15 12:07:10python-devsetkeywords: + patch
nosy: + python-dev

pull_requests: + pull_request21678
stage: patch review
2020-10-15 12:03:28conchylicultorcreate