Closed jaraco closed 7 months ago
I looked into this issue briefly yesterday and ascertained that it's not going to be an easy "fix". The original design intentionally did not attempt to provide full support for zip files without names, so providing such support is likely to break some (even documented) assumptions. Any fix is likely to be accompanied by a change in behavior that will likely preclude backporting. Users affected by this issue should supply a filename for their zipfile, even if it's just "<unnamed>".
I'm not sure I understand the distinction.
zipp
means to provide the same behavior (just earlier, to older Pythons), so the two implementations should be kept in sync.And it does currently through
.root
, which has its own issues (the name conflicts with the meaning ofpathlib.Path.root
).I don't like the implementation of
Path.filename
. I'm tempted to deprecate it altogether.__str__
provides something similar but different..name
,.parent
and newly.suffix
,.suffixes
, and.stem
all are ill-defined when the zipfile has no filename, so I believe an exception is appropriate in those cases.But you're right, it's not great to not have a good
__str__
representation if the zipfile has no name. I'll work on it.Originally posted by @jaraco in https://github.com/python/cpython/issues/100609#issuecomment-1636331936