summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2016-12-28 16:03:28 -0800
committerSteve Dower <steve.dower@microsoft.com>2016-12-28 16:03:28 -0800
commit0a24415b2fbb35a730e09cc798ff7ca7fd0492ae (patch)
tree799c6867a92ca96ed12ad75e4e62e660850112ca
parent13b0de95bcf86c0908dd844037a0d7b24c410315 (diff)
parent4b1e98b0af68ee80a37618ad599ead194f179cf1 (diff)
downloadcpython-git-0a24415b2fbb35a730e09cc798ff7ca7fd0492ae.tar.gz
Issue #29079: Prevent infinite loop in pathlib.resolve() on Windows
-rw-r--r--Lib/pathlib.py4
-rw-r--r--Misc/NEWS2
2 files changed, 5 insertions, 1 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index 69653938ef..0484dacd79 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -192,7 +192,9 @@ class _WindowsFlavour(_Flavour):
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
index 3d6aaa793b..1987e75c0e 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -208,6 +208,8 @@ Core and Builtins
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.