[issue21714] Path.with_name can construct invalid paths

2014-07-06 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ok, patch now applied (as well as the original patch for with_suffix()). Thank you very much! -- resolution: -> fixed stage: needs patch -> resolved status: open -> closed ___ Python tracker

[issue21714] Path.with_name can construct invalid paths

2014-07-06 Thread Roundup Robot
Roundup Robot added the comment: New changeset c2636b5816a3 by Antoine Pitrou in branch '3.4': Issue #21714: Disallow the construction of invalid paths using Path.with_name(). Original patch by Antony Lee. http://hg.python.org/cpython/rev/c2636b5816a3 -- nosy: +python-dev

[issue21714] Path.with_name can construct invalid paths

2014-06-22 Thread Antony Lee
Antony Lee added the comment: The attached patch fixes all the issues mentioned, and also integrates the fixes of issue 20639 (issues with with_suffix) as they are quite similar. -- keywords: +patch Added file: http://bugs.python.org/file35735/pathlib-with_name-with_suffix.patch __

[issue21714] Path.with_name can construct invalid paths

2014-06-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: > should "path.with_name('foo/')" be allowed? For sanity, I think path separators should be disallowed. -- ___ Python tracker ___ _

[issue21714] Path.with_name can construct invalid paths

2014-06-11 Thread Antony Lee
Antony Lee added the comment: I have the patch almost ready, but ran into another issue: should "path.with_name('foo/')" be allowed? It may make sense to treat it like "path.with_name('foo')", just like 'Path("foo/") == Path("foo")'. The implementation is also simpler with it, as it can reuse

[issue21714] Path.with_name can construct invalid paths

2014-06-11 Thread Antoine Pitrou
Antoine Pitrou added the comment: I think raising ValueError is the way to go. Would you like to try writing a patch for it? -- nosy: +pitrou stage: -> needs patch type: -> behavior ___ Python tracker __

[issue21714] Path.with_name can construct invalid paths

2014-06-10 Thread Antony Lee
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 r