mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Fix #18530. Remove extra stat call from posixpath.ismount
This commit is contained in:
parent
7b3902a20f
commit
06f6fbffd4
2 changed files with 17 additions and 8 deletions
|
@ -182,18 +182,24 @@ def lexists(path):
|
||||||
|
|
||||||
def ismount(path):
|
def ismount(path):
|
||||||
"""Test whether a path is a mount point"""
|
"""Test whether a path is a mount point"""
|
||||||
if islink(path):
|
|
||||||
# A symlink can never be a mount point
|
|
||||||
return False
|
|
||||||
try:
|
try:
|
||||||
s1 = os.lstat(path)
|
s1 = os.lstat(path)
|
||||||
|
except OSError:
|
||||||
|
# It doesn't exist -- so not a mount point. :-)
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
if stat.S_ISLNK(s1.st_mode):
|
||||||
|
return False
|
||||||
|
|
||||||
if isinstance(path, bytes):
|
if isinstance(path, bytes):
|
||||||
parent = join(path, b'..')
|
parent = join(path, b'..')
|
||||||
else:
|
else:
|
||||||
parent = join(path, '..')
|
parent = join(path, '..')
|
||||||
|
try:
|
||||||
s2 = os.lstat(parent)
|
s2 = os.lstat(parent)
|
||||||
except OSError:
|
except OSError:
|
||||||
return False # It doesn't exist -- so not a mount point :-)
|
return False
|
||||||
|
|
||||||
dev1 = s1.st_dev
|
dev1 = s1.st_dev
|
||||||
dev2 = s2.st_dev
|
dev2 = s2.st_dev
|
||||||
if dev1 != dev2:
|
if dev1 != dev2:
|
||||||
|
|
|
@ -162,6 +162,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #18530: Remove additional stat call from posixpath.ismount.
|
||||||
|
Patch by Alex Gaynor.
|
||||||
|
|
||||||
- Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj()
|
- Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj()
|
||||||
|
|
||||||
- Issue #9177: Calling read() or write() now raises ValueError, not
|
- Issue #9177: Calling read() or write() now raises ValueError, not
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue