]> granicus.if.org Git - python/commitdiff
Issue #29079: Prevent infinite loop in pathlib.resolve() on Windows
authorSteve Dower <steve.dower@microsoft.com>
Thu, 29 Dec 2016 00:02:59 +0000 (16:02 -0800)
committerSteve Dower <steve.dower@microsoft.com>
Thu, 29 Dec 2016 00:02:59 +0000 (16:02 -0800)
Lib/pathlib.py
Misc/NEWS

index 69653938ef721cd0a9b2178d1cb8cae1ed245cbb..0484dacd791a89826ea377c879fcc6a37b97412c 100644 (file)
@@ -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
index 176b1e9e1c0e203ffb60f6e4d744cde91af271f1..1112257a28afc02780a89a17a8d18cef42545bbf 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -40,6 +40,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.