From c746c4f353510a17683a49ed7f90ffaae664ff7b Mon Sep 17 00:00:00 2001 From: Barney Gale Date: Fri, 17 Apr 2020 18:42:06 +0100 Subject: [PATCH] bpo-39897: Remove needless `Path(self.parent)` call, which makes `is_mount()` misbehave in `Path` subclasses. (GH-18839) --- Lib/pathlib.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Lib/pathlib.py b/Lib/pathlib.py index d2053e62845..d3e89dfbc88 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -1438,9 +1438,8 @@ def is_mount(self): if not self.exists() or not self.is_dir(): return False - parent = Path(self.parent) try: - parent_dev = parent.stat().st_dev + parent_dev = self.parent.stat().st_dev except OSError: return False @@ -1448,7 +1447,7 @@ def is_mount(self): if dev != parent_dev: return True ino = self.stat().st_ino - parent_ino = parent.stat().st_ino + parent_ino = self.parent.stat().st_ino return ino == parent_ino def is_symlink(self):