[New-bugs-announce] [issue42383] Pdb does not correclty restart the target if it changes the current directory
Andrey Bienkowski
report at bugs.python.org
Tue Nov 17 02:26:31 EST 2020
New submission from Andrey Bienkowski <hexagonrecursion at gmail.com>:
This was mentioned in #31121, but I believe this deserves its own separate issue. If the debug target is specified using a relative path and later the current directory is changed, pdb tries to search for the target in the new current directory. This currently causes pdb to be unable to exit, which is what #31121 and #14743 are about, but even if they are fixed we would still be left with pdb exiting instead of restarting the target. This issues is about the latter.
To reproduce (same as #31121):
$ mkdir foo
$ cat > foo/script.py
import os
os.chdir('foo')
$ python3 -m pdb foo/script.py
> /home/user/foo/script.py(1)<module>()
-> import os
(Pdb) c
The program finished and will be restarted
Traceback (most recent call last):
File "/usr/lib64/python3.8/pdb.py", line 1704, in main
pdb._runscript(mainpyfile)
File "/usr/lib64/python3.8/pdb.py", line 1570, in _runscript
with io.open_code(filename) as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'foo/script.py'
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /usr/lib64/python3.8/pdb.py(1570)_runscript()
-> with io.open_code(filename) as fp:
----------
messages: 381213
nosy: hexagonrecursion
priority: normal
severity: normal
status: open
title: Pdb does not correclty restart the target if it changes the current directory
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42383>
_______________________________________
More information about the New-bugs-announce
mailing list