Title: Pdb does not correclty restart the target if it changes the current directory
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.10, Python 3.9, Python 3.8
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: hexagonrecursion
Priority: normal Keywords: patch

Created on 2020-11-17 07:26 by hexagonrecursion, last changed 2020-11-28 20:12 by epaine.

Pull Requests
URL Status Linked Edit
PR 23338 open hexagonrecursion, 2020-11-17 11:36
PR 23412 open hexagonrecursion, 2020-11-19 17:39
Messages (2)
msg381213 - (view) Author: Andrey Bienkowski (hexagonrecursion) * Date: 2020-11-17 07:26
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/
import os
$ python3 -m pdb foo/ 
> /home/user/foo/<module>()
-> import os
(Pdb) c
The program finished and will be restarted
Traceback (most recent call last):
  File "/usr/lib64/python3.8/", line 1704, in main
  File "/usr/lib64/python3.8/", line 1570, in _runscript
    with io.open_code(filename) as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'foo/'
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /usr/lib64/python3.8/
-> with io.open_code(filename) as fp:
msg381216 - (view) Author: Andrey Bienkowski (hexagonrecursion) * Date: 2020-11-17 07:50
I'm working on fixing this
Date User Action Args
2020-11-28 20:12:16epainesettype: behavior
components: + Library (Lib)
versions: + Python 3.8, Python 3.9, Python 3.10
2020-11-19 17:39:16hexagonrecursionsetpull_requests: + pull_request22305
2020-11-17 11:36:56hexagonrecursionsetkeywords: + patch
stage: patch review
pull_requests: + pull_request22227
2020-11-17 07:50:17hexagonrecursionsetmessages: + msg381216
2020-11-17 07:26:31hexagonrecursioncreate