[issue37130] pathlib.with_name() doesn't like unnamed files.

Brett Cannon report at bugs.python.org
Mon Jun 3 14:58:59 EDT 2019


Brett Cannon <brett at python.org> added the comment:

The inconsistency is a bit weird. Looking at https://github.com/python/cpython/blob/master/Lib/pathlib.py#L825 the question is why is self.name not being set for '.' but it is for '..'. I suspect there's special-casing for '.' somewhere that sets self.name to '' for '.' but leaves it alone in all other instances.

Based on what with_name() is supposed to do I would argue that '..' shouldn't work since without a filename the with_name() method makes no sense.

----------
nosy: +brett.cannon

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


More information about the Python-bugs-list mailing list