Skip to content

Commit c746c4f

Browse files
authored
bpo-39897: Remove needless Path(self.parent) call, which makes is_mount() misbehave in Path subclasses. (GH-18839)
1 parent 75a3378 commit c746c4f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Lib/pathlib.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,17 +1438,16 @@ def is_mount(self):
14381438
if not self.exists() or not self.is_dir():
14391439
return False
14401440

1441-
parent = Path(self.parent)
14421441
try:
1443-
parent_dev = parent.stat().st_dev
1442+
parent_dev = self.parent.stat().st_dev
14441443
except OSError:
14451444
return False
14461445

14471446
dev = self.stat().st_dev
14481447
if dev != parent_dev:
14491448
return True
14501449
ino = self.stat().st_ino
1451-
parent_ino = parent.stat().st_ino
1450+
parent_ino = self.parent.stat().st_ino
14521451
return ino == parent_ino
14531452

14541453
def is_symlink(self):

0 commit comments

Comments
 (0)