diff options
author | Steve Dower <steve.dower@microsoft.com> | 2016-12-28 16:02:59 -0800 |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2016-12-28 16:02:59 -0800 |
commit | 4b1e98b0af68ee80a37618ad599ead194f179cf1 (patch) | |
tree | 8aafb341f8ec39e970d0a9b3ef13d817d97a60a4 /Lib/pathlib.py | |
parent | 40619399bd4798d9edb50fe80afe8eff3197d51d (diff) | |
download | cpython-4b1e98b0af68ee80a37618ad599ead194f179cf1.tar.gz cpython-4b1e98b0af68ee80a37618ad599ead194f179cf1.zip |
Issue #29079: Prevent infinite loop in pathlib.resolve() on Windows
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r-- | Lib/pathlib.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py index 69653938ef7..0484dacd791 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 |