mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
GH-113528: Deoptimise pathlib._abc.PathBase._make_child_relpath()
(#113532)
Call straight through to `joinpath()` in `PathBase._make_child_relpath()`. Move optimised/caching code to `pathlib.Path._make_child_relpath()`
This commit is contained in:
parent
2fd2e74793
commit
9100fc407e
2 changed files with 17 additions and 14 deletions
|
@ -753,20 +753,7 @@ class PathBase(PurePathBase):
|
|||
return entry
|
||||
|
||||
def _make_child_relpath(self, name):
|
||||
path_str = str(self)
|
||||
tail = self._tail
|
||||
if tail:
|
||||
path_str = f'{path_str}{self.pathmod.sep}{name}'
|
||||
elif path_str != '.':
|
||||
path_str = f'{path_str}{name}'
|
||||
else:
|
||||
path_str = name
|
||||
path = self.with_segments(path_str)
|
||||
path._str = path_str
|
||||
path._drv = self.drive
|
||||
path._root = self.root
|
||||
path._tail_cached = tail + [name]
|
||||
return path
|
||||
return self.joinpath(name)
|
||||
|
||||
def glob(self, pattern, *, case_sensitive=None, follow_symlinks=None):
|
||||
"""Iterate over this subtree and yield all existing files (of any
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue