[New-bugs-announce] [issue37520] zipfile.Path.parent returns incorrect value (same as self) for directory ref

Jason R. Coombs report at bugs.python.org
Sun Jul 7 16:54:03 EDT 2019


New submission from Jason R. Coombs <jaraco at jaraco.com>:

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.

----------
components: Library (Lib)
messages: 347479
nosy: jaraco
priority: normal
severity: normal
status: open
title: zipfile.Path.parent returns incorrect value (same as self) for directory ref
versions: Python 3.8

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


More information about the New-bugs-announce mailing list