This commit is contained in:
ton
2024-10-07 10:13:40 +07:00
parent aa1631742f
commit 3a7d696db6
9729 changed files with 1832837 additions and 161742 deletions

View File

@@ -630,8 +630,7 @@ class PurePath(object):
if not self.name:
raise ValueError("%r has an empty name" % (self,))
f = self._flavour
drv, root, tail = f.splitroot(name)
if drv or root or not tail or f.sep in tail or (f.altsep and f.altsep in tail):
if not name or f.sep in name or (f.altsep and f.altsep in name) or name == '.':
raise ValueError("Invalid name %r" % (name))
return self._from_parsed_parts(self.drive, self.root,
self._tail[:-1] + [name])
@@ -1006,7 +1005,7 @@ class Path(PurePath):
def open(self, mode='r', buffering=-1, encoding=None,
errors=None, newline=None):
"""
Open the file pointed by this path and return a file object, as
Open the file pointed to by this path and return a file object, as
the built-in open() function does.
"""
if "b" not in mode: