This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author remi.lapeyre
Recipients Kerrick Staley, remi.lapeyre, terry.reedy, xdegaye
Date 2020-06-02.07:42:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1591083772.59.0.356120153538.issue40403@roundup.psfhosted.org>
In-reply-to
Content
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?
History
Date User Action Args
2020-06-02 07:42:52remi.lapeyresetrecipients: + remi.lapeyre, terry.reedy, xdegaye, Kerrick Staley
2020-06-02 07:42:52remi.lapeyresetmessageid: <1591083772.59.0.356120153538.issue40403@roundup.psfhosted.org>
2020-06-02 07:42:52remi.lapeyrelinkissue40403 messages
2020-06-02 07:42:52remi.lapeyrecreate