Rémi Lapeyre <remi.lape...@henki.fr> added the comment: Yes, the patch by Terry Reedy fixes this issue while still breaking the loop from `def f: pass`.
It will start the debugger once for `def f: pass` which may be weird as in this case no user code has been executed and it will be in bdb which may confuse users: Traceback (most recent call last): File "/Users/remi/src/cpython/Lib/pdb.py", line 1703, in main pdb._runscript(mainpyfile) File "/Users/remi/src/cpython/Lib/pdb.py", line 1572, in _runscript self.run(statement) File "/Users/remi/src/cpython/Lib/bdb.py", line 580, in run exec(cmd, globals, locals) File "<string>", line 1, in <module> File "/Users/remi/src/cpython/tests.py", line 1 def f: pass ^ SyntaxError: invalid syntax Uncaught exception. Entering post mortem debugging Running 'cont' or 'step' will restart the program > <string>(1)<module>() (Pdb) bt /Users/remi/src/cpython/Lib/pdb.py(1703)main() -> pdb._runscript(mainpyfile) /Users/remi/src/cpython/Lib/pdb.py(1572)_runscript() -> self.run(statement) /Users/remi/src/cpython/Lib/bdb.py(580)run() -> exec(cmd, globals, locals) > <string>(1)<module>() Perhaps we should should test whether the exception happened there and not drop in the debugger in that case? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40403> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com