[Python-checkins] cpython (3.6): Issue #29079: Prevent infinite loop in pathlib.resolve() on Windows
steve.dower
python-checkins at python.org
Wed Dec 28 19:03:55 EST 2016
https://hg.python.org/cpython/rev/af8c8551ea45
changeset: 105883:af8c8551ea45
branch: 3.6
parent: 105881:048d1942b325
user: Steve Dower <steve.dower at microsoft.com>
date: Wed Dec 28 16:02:59 2016 -0800
summary:
Issue #29079: Prevent infinite loop in pathlib.resolve() on Windows
files:
Lib/pathlib.py | 4 +++-
Misc/NEWS | 2 ++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -192,7 +192,9 @@
s = self._ext_to_normal(_getfinalpathname(s))
except FileNotFoundError:
previous_s = s
- s = os.path.abspath(os.path.join(s, os.pardir))
+ s = os.path.dirname(s)
+ if previous_s == s:
+ return path
else:
if previous_s is None:
return s
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -40,6 +40,8 @@
Library
-------
+- Issue #29079: Prevent infinite loop in pathlib.resolve() on Windows
+
- Issue #13051: Fixed recursion errors in large or resized
curses.textpad.Textbox. Based on patch by Tycho Andersen.
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list