New submission from July Tikhonov:

This is not a real-world example, but it brokes some invariant (part of path 
must not contain separator):

>>> pathlib.PurePath('/a/b.c.d').with_suffix('///')
PurePosixPath('/a/b.c///')
>>> pathlib.PurePath('/a/b.c.d').with_suffix('/not/split/into/parts').parts
('/', 'a', 'b.c/not/split/into/parts')

I think these cases should raise an error.

I would also like to consider the following to be an error, since the argument 
of with_suffix() is not exactly a suffix:

>>> PurePath('/a/b.c.d').with_suffix('e')
PurePosixPath('/a/b.ce')

but I'm far less sure in this case.

----------
components: Library (Lib)
messages: 207185
nosy: july, pitrou
priority: normal
severity: normal
status: open
title: pathlib.PurePath.with_suffix() allows creation of otherwise impossible 
paths
versions: Python 3.4, Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20111>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to