# HG changeset patch # Parent 032103c7ed47bbe9cc90281e023c32effef78d43 diff --git a/Lib/pathlib.py b/Lib/pathlib.py --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -755,11 +755,10 @@ def with_suffix(self, suffix): """Return a new path with the file suffix changed (or added, if none).""" # XXX if suffix is None, should the current suffix be removed? - drv, root, parts = self._flavour.parse_parts((suffix,)) - if drv or root or len(parts) != 1: + f = self._flavour + if f.sep in suffix or f.altsep and f.altsep in suffix: raise ValueError("Invalid suffix %r" % (suffix)) - suffix = parts[0] - if not suffix.startswith('.'): + if (not suffix.startswith('.') or suffix == '.') and suffix != '': raise ValueError("Invalid suffix %r" % (suffix)) name = self.name if not name: