From 038125082b366ab6444291ae63fc162e82289fb1 2022-02-25 10:11:38 From: Matthias Bussonnier Date: 2022-02-25 10:11:38 Subject: [PATCH] Merge pull request #13537 from bucknerns/fix_path_loop Fix for symlink resolving --- diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 61e1541..42364eb 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -774,8 +774,11 @@ class InteractiveShell(SingletonConfigurable): # So we just check every item in the symlink tree (generally <= 3) paths = [p] while p.is_symlink(): - p = Path(os.readlink(p)) - paths.append(p.resolve()) + new_path = p.readlink() + if not new_path.is_absolute(): + new_path = p.parent / new_path + p = new_path + paths.append(p) # In Cygwin paths like "c:\..." and '\cygdrive\c\...' are possible if p_venv.parts[1] == "cygdrive":