[Python-checkins] bpo-39897: Remove needless `Path(self.parent)` call, which makes `is_mount()` misbehave in `Path` subclasses. (GH-18839)
Barney Gale
webhook-mailer at python.org
Fri Apr 17 13:42:14 EDT 2020
https://github.com/python/cpython/commit/c746c4f353510a17683a49ed7f90ffaae664ff7b
commit: c746c4f353510a17683a49ed7f90ffaae664ff7b
branch: master
author: Barney Gale <barney.gale at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-04-17T19:42:06+02:00
summary:
bpo-39897: Remove needless `Path(self.parent)` call, which makes `is_mount()` misbehave in `Path` subclasses. (GH-18839)
files:
M Lib/pathlib.py
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index d2053e6284501..d3e89dfbc88ac 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):
More information about the Python-checkins
mailing list