<p>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.)</p>
<p>Victor</p>
<div class="gmail_quote">Le 22 juil. 2013 20:08, "brian.curtin" <<a href="mailto:python-checkins@python.org">python-checkins@python.org</a>> a écrit :<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<a href="http://hg.python.org/cpython/rev/240adc564539" target="_blank">http://hg.python.org/cpython/rev/240adc564539</a><br>
changeset: 84791:240adc564539<br>
parent: 84788:84d6c1c0665e<br>
user: Brian Curtin <<a href="mailto:brian@python.org">brian@python.org</a>><br>
date: Mon Jul 22 13:07:52 2013 -0500<br>
summary:<br>
Fix #18530. Remove extra stat call from posixpath.ismount<br>
<br>
files:<br>
Lib/posixpath.py | 22 ++++++++++++++--------<br>
Misc/NEWS | 3 +++<br>
2 files changed, 17 insertions(+), 8 deletions(-)<br>
<br>
<br>
diff --git a/Lib/posixpath.py b/Lib/posixpath.py<br>
--- a/Lib/posixpath.py<br>
+++ b/Lib/posixpath.py<br>
@@ -182,18 +182,24 @@<br>
<br>
def ismount(path):<br>
"""Test whether a path is a mount point"""<br>
- if islink(path):<br>
- # A symlink can never be a mount point<br>
- return False<br>
try:<br>
s1 = os.lstat(path)<br>
- if isinstance(path, bytes):<br>
- parent = join(path, b'..')<br>
- else:<br>
- parent = join(path, '..')<br>
+ except OSError:<br>
+ # It doesn't exist -- so not a mount point. :-)<br>
+ return False<br>
+ else:<br>
+ if stat.S_ISLNK(s1.st_mode):<br>
+ return False<br>
+<br>
+ if isinstance(path, bytes):<br>
+ parent = join(path, b'..')<br>
+ else:<br>
+ parent = join(path, '..')<br>
+ try:<br>
s2 = os.lstat(parent)<br>
except OSError:<br>
- return False # It doesn't exist -- so not a mount point :-)<br>
+ return False<br>
+<br>
dev1 = s1.st_dev<br>
dev2 = s2.st_dev<br>
if dev1 != dev2:<br>
diff --git a/Misc/NEWS b/Misc/NEWS<br>
--- a/Misc/NEWS<br>
+++ b/Misc/NEWS<br>
@@ -162,6 +162,9 @@<br>
Library<br>
-------<br>
<br>
+- Issue #18530: Remove additional stat call from posixpath.ismount.<br>
+ Patch by Alex Gaynor.<br>
+<br>
- Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj()<br>
<br>
- Issue #9177: Calling read() or write() now raises ValueError, not<br>
<br>
--<br>
Repository URL: <a href="http://hg.python.org/cpython" target="_blank">http://hg.python.org/cpython</a><br>
<br>_______________________________________________<br>
Python-checkins mailing list<br>
<a href="mailto:Python-checkins@python.org">Python-checkins@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-checkins" target="_blank">http://mail.python.org/mailman/listinfo/python-checkins</a><br>
<br></blockquote></div>