This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: zipfile.Path.parent returns incorrect value (same as self) for directory ref
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: jaraco
Priority: normal Keywords: patch

Created on 2019-07-07 20:54 by jaraco, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 14638 merged jaraco, 2019-07-07 21:07
PR 14641 merged miss-islington, 2019-07-07 21:39
Messages (3)
msg347479 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2019-07-07 20:54
Originally reported in https://github.com/jaraco/zipp/issues/7, the parent of a Path object referencing a directory is returning the incorrect result:

cpython master $ docker run -it python:rc-buster                                                                                             
Python 3.8.0b1 (default, Jun 27 2019, 22:38:51) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import zipfile
>>> import io
>>> zf = zipfile.ZipFile(io.BytesIO(), 'w')
>>> p = zipfile.Path(zf)
>>> p.joinpath('missing/').parent
Path(None, 'missing/')
>>> p.joinpath('missing/').parent.at
'missing/'

The expected value is '' as the parent of a single-level directory is the parent directory.
msg347480 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2019-07-07 21:37
New changeset 38f44b4a4adc37e8f5f8971917d8b3145f351a56 by Jason R. Coombs in branch 'master':
bpo-37520: Correct behavior for zipfile.Path.parent (GH-14638)
https://github.com/python/cpython/commit/38f44b4a4adc37e8f5f8971917d8b3145f351a56
msg347481 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2019-07-07 22:05
New changeset 66905d14672517d50dc8ba516b9839f9ddbcc131 by Jason R. Coombs (Miss Islington (bot)) in branch '3.8':
bpo-37520: Correct behavior for zipfile.Path.parent (GH-14638) (GH-14641)
https://github.com/python/cpython/commit/66905d14672517d50dc8ba516b9839f9ddbcc131
History
Date User Action Args
2022-04-11 14:59:17adminsetgithub: 81701
2019-07-07 22:07:48jaracosetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-07-07 22:05:57jaracosetmessages: + msg347481
2019-07-07 21:39:00miss-islingtonsetpull_requests: + pull_request14453
2019-07-07 21:37:53jaracosetmessages: + msg347480
2019-07-07 21:07:31jaracosetkeywords: + patch
stage: patch review
pull_requests: + pull_request14452
2019-07-07 20:54:03jaracocreate