From c2c6349ff101cfb07b7821c4bd51d8ba2e74f759 2022-08-30 13:01:39 From: Matthias Bussonnier Date: 2022-08-30 13:01:39 Subject: [PATCH] Merge pull request #13669 from achhina/fix-issue-12967 Replaced string path in _dh with PosixPath() --- diff --git a/IPython/core/magics/osm.py b/IPython/core/magics/osm.py index 41957a2..f3fa246 100644 --- a/IPython/core/magics/osm.py +++ b/IPython/core/magics/osm.py @@ -8,6 +8,7 @@ builtin. import io import os +import pathlib import re import sys from pprint import pformat @@ -409,7 +410,7 @@ class OSMagics(Magics): except OSError: print(sys.exc_info()[1]) else: - cwd = os.getcwd() + cwd = pathlib.Path.cwd() dhist = self.shell.user_ns['_dh'] if oldcwd != cwd: dhist.append(cwd) @@ -419,7 +420,7 @@ class OSMagics(Magics): os.chdir(self.shell.home_dir) if hasattr(self.shell, 'term_title') and self.shell.term_title: set_term_title(self.shell.term_title_format.format(cwd="~")) - cwd = os.getcwd() + cwd = pathlib.Path.cwd() dhist = self.shell.user_ns['_dh'] if oldcwd != cwd: