New submission from Antony Lee:
Path.with_name can be used to construct paths containing slashes as name
contents (rather than as separators), as demonstrated below.
$ python -c 'from pathlib import Path;
print(Path("foo").with_name("bar/baz").name)'
bar/baz
This should be changed to either raise a ValueError, or behave like path.parent
/ new_name. Given the amount of checking in the related with_suffix method
(and the fact that the second option can be readily implemented by hand), the
first option seems preferable.
----------
components: Library (Lib)
messages: 220235
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: Path.with_name can construct invalid paths
versions: Python 3.4, Python 3.5
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue21714>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com