Description:
The pushd context manager in nbdime/utils.py uses os.curdir instead of os.getcwd() to save the current directory. Since os.curdir is the constant string '.', the directory is never actually restored on exit.
Minimal Reproduction:
import os, tempfile
from nbdime.utils import pushd
original = os.getcwd()
with tempfile.TemporaryDirectory() as td:
with pushd(td): pass
print(f"Expected: {original}")
print(f"Actual: {os.getcwd()}")
print(f"Match: {original == os.getcwd()}")
Expected: Current directory restored to original after exiting context.
Actual: Current directory remains changed.
Fix:
Change line 269 in utils.py from:
to: