From: Steve Dower Date: Thu, 29 Dec 2016 00:02:59 +0000 (-0800) Subject: Issue #29079: Prevent infinite loop in pathlib.resolve() on Windows X-Git-Tag: v3.6.1rc1~242 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b1e98b0af68ee80a37618ad599ead194f179cf1;p=python Issue #29079: Prevent infinite loop in pathlib.resolve() on Windows --- 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 176b1e9e1c..1112257a28 100644 --- 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.