-
-
Notifications
You must be signed in to change notification settings - Fork 29.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot quit pdb when there is a syntax error in the debuggee (must kill it) #60384
Comments
$ tmp=`mktemp /tmp/foo.XXXXXXXXXX`; echo 'def foo: pass' > $tmp; python3 -m pdb $tmp; rm $tmp
Traceback (most recent call last):
File "/usr/local/lib/python3.2/pdb.py", line 1556, in main
pdb._runscript(mainpyfile)
File "/usr/local/lib/python3.2/pdb.py", line 1437, in _runscript
self.run(statement)
File "/usr/local/lib/python3.2/bdb.py", line 392, in run
exec(cmd, globals, locals)
File "<string>", line 1, in <module>
File "/tmp/foo.iLhPYHBZrF", line 1
def foo: pass
^
SyntaxError: invalid syntax
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> <string>(1)<module>()
(Pdb) quit
Post mortem debugger finished. The /tmp/foo.iLhPYHBZrF will be restarted
Traceback (most recent call last):
File "/usr/local/lib/python3.2/pdb.py", line 1556, in main
pdb._runscript(mainpyfile)
File "/usr/local/lib/python3.2/pdb.py", line 1437, in _runscript
self.run(statement)
File "/usr/local/lib/python3.2/bdb.py", line 392, in run
exec(cmd, globals, locals)
File "<string>", line 1, in <module>
File "/tmp/foo.iLhPYHBZrF", line 1
def foo: pass
^
SyntaxError: invalid syntax
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> <string>(1)<module>()
(Pdb) --KeyboardInterrupt--
(Pdb) |
This continues to be a problem on Python-3.3.0 |
See how this is fixed at |
Reported again in bpo-24957 Xavier, your link is out of date. |
Simple fix attached. I copied the exit code from this part of the 'while True:' loop.
I am not sure if the conditional is still needed there. Xavier, if you have a better patch, please upload it. |
Slightly better in that pdb exits in case of a syntax error instead of proposing to restart the program which does not make sense. A test case is included. |
New changeset 26c4db1a0aea by Terry Jan Reedy in branch '2.7': New changeset 2d4aac2ab253 by Terry Jan Reedy in branch '3.4': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: