8000 [3.8] bpo-42383: pdb: do not fail to restart the target if the curre… · python/cpython@d863dee · GitHub
[go: up one dir, main page]

Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d863dee

Browse files
[3.8] bpo-42383: pdb: do not fail to restart the target if the current directory changed (GH-23412) (#24323)
1 parent c10180e commit d863dee

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Lib/test/test_pdb.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,6 +1699,29 @@ def test_issue42384_symlink(self):
16991699

17001700
self.assertEqual(stdout.split('\n')[2].rstrip('\r'), expected)
17011701

1702+
def test_issue42383(self):
1703+
with support.temp_cwd() as cwd:
1704+
with open('foo.py', 'w') as f:
1705+
s = textwrap.dedent("""
1706+
print('The correct file was executed')
1707+
1708+
import os
1709+
os.chdir("subdir")
1710+
""")
1711+
f.write(s)
1712+
1713+
subdir = os.path.join(cwd, 'subdir')
1714+
os.mkdir(subdir)
1715+
os.mkdir(os.path.join(subdir, 'subdir'))
1716+
wrong_file = os.path.join(subdir, 'foo.py')
1717+
1718+
with open(wrong_file, 'w') as f:
1719+
f.write('print("The wrong file was executed")')
1720+
1721+
stdout, stderr = self._run_pdb(['foo.py'], 'c\nc\nq')
1722+
expected = '(Pdb) The correct file was executed'
1723+
self.assertEqual(stdout.split('\n')[6].rstrip('\r'), expected)
1724+
17021725

17031726
def load_tests(*args):
17041727
from test import test_pdb
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix pdb: previously pdb would fail to restart the debugging target if it was
2+
specified using a relative path and the current directory changed.

0 commit comments

Comments
 (0)
0