From d7c3a90b4ea05a134508fade467e4820a8e53d2e Mon Sep 17 00:00:00 2001 From: barneygale Date: Sun, 8 Mar 2020 04:13:08 +0000 Subject: [PATCH] bpo-39897: Remove needless `Path(self.parent)` call, which makes `is_mount()` misbehave in `Path` subclasses. --- Lib/pathlib.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Lib/pathlib.py b/Lib/pathlib.py index 851aabd479725f..681bb65c649633 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -1457,9 +1457,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 @@ -1467,7 +1466,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):