[Python-Dev] [Python-checkins] cpython: Fix #18530. Remove extra stat call from posixpath.ismount
Victor Stinner
victor.stinner at gmail.com
Tue Jul 23 01:36:47 CEST 2013
Could you please keep the comment "# A symlink can never be a mount point"
? It is useful. (I didn't know that, I'm not a windows developer.)
Victor
Le 22 juil. 2013 20:08, "brian.curtin" <python-checkins at python.org> a
écrit :
> http://hg.python.org/cpython/rev/240adc564539
> changeset: 84791:240adc564539
> parent: 84788:84d6c1c0665e
> user: Brian Curtin <brian at python.org>
> date: Mon Jul 22 13:07:52 2013 -0500
> summary:
> Fix #18530. Remove extra stat call from posixpath.ismount
>
> files:
> Lib/posixpath.py | 22 ++++++++++++++--------
> Misc/NEWS | 3 +++
> 2 files changed, 17 insertions(+), 8 deletions(-)
>
>
> diff --git a/Lib/posixpath.py b/Lib/posixpath.py
> --- a/Lib/posixpath.py
> +++ b/Lib/posixpath.py
> @@ -182,18 +182,24 @@
>
> def ismount(path):
> """Test whether a path is a mount point"""
> - if islink(path):
> - # A symlink can never be a mount point
> - return False
> try:
> s1 = os.lstat(path)
> - if isinstance(path, bytes):
> - parent = join(path, b'..')
> - else:
> - parent = join(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):
> + parent = join(path, b'..')
> + else:
> + parent = join(path, '..')
> + try:
> s2 = os.lstat(parent)
> except OSError:
> - return False # It doesn't exist -- so not a mount point :-)
> + return False
> +
> dev1 = s1.st_dev
> dev2 = s2.st_dev
> if dev1 != dev2:
> diff --git a/Misc/NEWS b/Misc/NEWS
> --- a/Misc/NEWS
> +++ b/Misc/NEWS
> @@ -162,6 +162,9 @@
> 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 #9177: Calling read() or write() now raises ValueError, not
>
> --
> Repository URL: http://hg.python.org/cpython
>
> _______________________________________________
> Python-checkins mailing list
> Python-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-checkins
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130723/0df23566/attachment.html>
More information about the Python-Dev
mailing list