Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
Prev Previous commit
Maintain _str, _drv, _root and _tail_cached.
  • Loading branch information
barneygale committed Jan 4, 2024
commit fbd435763eb95682e71ed11d0e37e0c6f974aabc
8 changes: 6 additions & 2 deletions Lib/pathlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,12 @@ def _scandir(self):

def _make_child_entry(self, entry):
# Transform an entry yielded from _scandir() into a path object.
path = self.with_segments(entry.path)
path._str = entry.name if str(self) == '.' else entry.path
path_str = entry.name if str(self) == '.' else entry.path
path = self.with_segments(path_str)
path._str = path_str
path._drv = self.drive
path._root = self.root
path._tail_cached = self._tail + [entry.name]
return path

def absolute(self):
Expand Down