Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ca3f435f
Commit
ca3f435f
authored
Sep 05, 2015
by
Terry Jan Reedy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #16180: Exit pdb if file has syntax error, instead of trapping user
in an infinite loop. Patch by Xavier de Gaye.
parent
6fb5bae2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
0 deletions
+18
-0
Lib/pdb.py
Lib/pdb.py
+3
-0
Lib/test/test_pdb.py
Lib/test/test_pdb.py
+12
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/pdb.py
View file @
ca3f435f
...
...
@@ -1669,6 +1669,9 @@ def main():
# In most cases SystemExit does not warrant a post-mortem session.
print
(
"The program exited via sys.exit(). Exit status:"
,
end
=
' '
)
print
(
sys
.
exc_info
()[
1
])
except
SyntaxError
:
traceback
.
print_exc
()
sys
.
exit
(
1
)
except
:
traceback
.
print_exc
()
print
(
"Uncaught exception. Entering post mortem debugging"
)
...
...
Lib/test/test_pdb.py
View file @
ca3f435f
...
...
@@ -1043,6 +1043,18 @@ class PdbTestCase(unittest.TestCase):
self
.
assertNotIn
(
'Error'
,
stdout
.
decode
(),
"Got an error running test script under PDB"
)
def
test_issue16180
(
self
):
# A syntax error in the debuggee.
script
=
"def f: pass
\
n
"
commands
=
''
expected
=
"SyntaxError:"
stdout
,
stderr
=
self
.
run_pdb
(
script
,
commands
)
self
.
assertIn
(
expected
,
stdout
,
'
\
n
\
n
Expected:
\
n
{}
\
n
Got:
\
n
{}
\
n
'
'Fail to handle a syntax error in the debuggee.'
.
format
(
expected
,
stdout
))
def
tearDown
(
self
):
support
.
unlink
(
support
.
TESTFN
)
...
...
Misc/NEWS
View file @
ca3f435f
...
...
@@ -81,6 +81,9 @@ Core and Builtins
Library
-------
-
Issue
#
16180
:
Exit
pdb
if
file
has
syntax
error
,
instead
of
trapping
user
in
an
infinite
loop
.
Patch
by
Xavier
de
Gaye
.
-
Issue
#
21112
:
Fix
regression
in
unittest
.
expectedFailure
on
subclasses
.
Patch
from
Berker
Peksag
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment