Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue16180

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:cannot quit pdb when there is a syntax error in the debuggee (must kill it)
Type:behaviorStage:resolved
Components:Library (Lib)Versions:Python 3.6, Python 3.4, Python 3.5, Python 2.7
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: asvetlov, georg.brandl, python-dev, rurpy2, terry.reedy, xdegaye
Priority:normalKeywords:patch

Created on2012-10-09 19:33 byxdegaye, last changed2022-04-11 14:57 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
pdbloopfix.diffterry.reedy,2015-09-04 18:19review
pdb_syntax_error.patchxdegaye,2015-09-05 10:08review
Messages (7)
msg172508 -(view)Author: Xavier de Gaye (xdegaye)*(Python triager)Date: 2012-10-09 19:33
$ tmp=`mktemp /tmp/foo.XXXXXXXXXX`; echo 'def foo: pass' > $tmp; python3 -m pdb $tmp; rm $tmpTraceback (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 syntaxUncaught exception. Entering post mortem debuggingRunning 'cont' or 'step' will restart the program> <string>(1)<module>()(Pdb) quitPost mortem debugger finished. The /tmp/foo.iLhPYHBZrF will be restartedTraceback (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 syntaxUncaught exception. Entering post mortem debuggingRunning 'cont' or 'step' will restart the program> <string>(1)<module>()(Pdb) --KeyboardInterrupt--(Pdb)
msg175970 -(view)Author: rurpy (rurpy2)Date: 2012-11-19 21:54
This continues to be a problem on Python-3.3.0
msg176274 -(view)Author: Xavier de Gaye (xdegaye)*(Python triager)Date: 2012-11-24 10:49
See how this is fixed athttp://code.google.com/p/pdb-clone/source/detail?r=0d4d905c6e0aa9c47611dbae514d3f7f53776dcb
msg249797 -(view)Author: Terry J. Reedy (terry.reedy)*(Python committer)Date: 2015-09-04 17:49
Reported again in#24957Xavier, your link is out of date.
msg249802 -(view)Author: Terry J. Reedy (terry.reedy)*(Python committer)Date: 2015-09-04 18:19
Simple fix attached.  I copied the exit code from this part of the 'while True:' loop.        try:            pdb._runscript(mainpyfile)            if pdb._user_requested_quit:                break            print("The program finished and will be restarted")I am not sure if the conditional is still needed there.Xavier, if you have a better patch, please upload it.
msg249900 -(view)Author: Xavier de Gaye (xdegaye)*(Python triager)Date: 2015-09-05 10:08
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.
msg249949 -(view)Author: Roundup Robot (python-dev)(Python triager)Date: 2015-09-05 23:19
New changeset26c4db1a0aea by Terry Jan Reedy in branch '2.7':Issue#16180: Exit pdb if file has syntax error, instead of trapping userhttps://hg.python.org/cpython/rev/26c4db1a0aeaNew changeset2d4aac2ab253 by Terry Jan Reedy in branch '3.4':Issue#16180: Exit pdb if file has syntax error, instead of trapping userhttps://hg.python.org/cpython/rev/2d4aac2ab253
History
DateUserActionArgs
2022-04-11 14:57:37adminsetgithub: 60384
2015-09-05 23:20:31terry.reedysetstatus: open -> closed
resolution: fixed
stage: test needed -> resolved
2015-09-05 23:19:05python-devsetnosy: +python-dev
messages: +msg249949
2015-09-05 10:09:00xdegayesetfiles: +pdb_syntax_error.patch

messages: +msg249900
2015-09-04 18:19:06terry.reedysetfiles: +pdbloopfix.diff
keywords: +patch
messages: +msg249802
2015-09-04 17:50:44terry.reedylinkissue24957 superseder
2015-09-04 17:49:44terry.reedysetversions: + Python 2.7, Python 3.4, Python 3.5, Python 3.6, - Python 3.3
nosy: +georg.brandl,terry.reedy

messages: +msg249797

stage: test needed
2012-12-05 11:08:21asvetlovsetnosy: +asvetlov
2012-11-24 10:49:13xdegayesetmessages: +msg176274
2012-11-19 21:54:52rurpy2setnosy: +rurpy2

messages: +msg175970
versions: + Python 3.3, - Python 3.2
2012-10-09 19:33:24xdegayecreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp