Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/pathlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def __new__(cls, *args, **kwargs):
cls = PureWindowsPath if os.name == 'nt' else PurePosixPath
return object.__new__(cls)

def __init__(self, *args):
def _load_args(self, args):
Comment thread
barneygale marked this conversation as resolved.
Resolved
paths = []
for arg in args:
if isinstance(arg, PurePath):
Expand All @@ -90,7 +90,7 @@ def __init__(self, *args):
"object where __fspath__ returns a str, "
f"not {type(path).__name__!r}")
paths.append(path)
super().__init__(*paths)
return paths

def __reduce__(self):
# Using the parts tuple helps share interned path parts
Expand Down
8 changes: 6 additions & 2 deletions Lib/pathlib/_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,14 @@ class PurePathBase:
)
pathmod = os.path

def __init__(self, *paths):
self._raw_paths = paths
def __init__(self, *args):
self._raw_paths = self._load_args(args)
self._resolving = False

def _load_args(self, args):
Comment thread
barneygale marked this conversation as resolved.
Resolved
# overridden in pathlib.PurePath
return args

def with_segments(self, *pathsegments):
"""Construct a new path object from any number of path-like objects.
Subclasses may override this method to customize how new path objects
Expand Down