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

Created on 2020-10-15 12:03 by conchylicultor, last changed 2021-05-24 18:41 by jaraco. This issue is now closed.

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

```
class MyPath(zipfile.Path):
  pass


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](https://github.com/jaraco/zipp/issues/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.
msg379601 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2020-10-25 18:45
New changeset d1a0a960ee493262fb95a0f5b795b5b6d75cecb8 by Jason R. Coombs in branch 'master':
bpo-42043: Add support for zipfile.Path subclasses (#22716)
https://github.com/python/cpython/commit/d1a0a960ee493262fb95a0f5b795b5b6d75cecb8
msg394262 - (view) Author: Filipe LaĆ­ns (FFY00) * (Python triager) Date: 2021-05-24 18:35
This can be closed now.
History
Date User Action Args
2021-05-24 18:41:22jaracosetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-05-24 18:35:59FFY00setnosy: + FFY00
messages: + msg394262
2020-10-25 18:45:12jaracosetmessages: + msg379601
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