Kaydet (Commit) e989bf58 authored tarafından Terry Jan Reedy's avatar Terry Jan Reedy

merge from 3.4

...@@ -1669,6 +1669,9 @@ def main(): ...@@ -1669,6 +1669,9 @@ def main():
# In most cases SystemExit does not warrant a post-mortem session. # In most cases SystemExit does not warrant a post-mortem session.
print("The program exited via sys.exit(). Exit status:", end=' ') print("The program exited via sys.exit(). Exit status:", end=' ')
print(sys.exc_info()[1]) print(sys.exc_info()[1])
except SyntaxError:
traceback.print_exc()
sys.exit(1)
except: except:
traceback.print_exc() traceback.print_exc()
print("Uncaught exception. Entering post mortem debugging") print("Uncaught exception. Entering post mortem debugging")
......
...@@ -1043,6 +1043,18 @@ class PdbTestCase(unittest.TestCase): ...@@ -1043,6 +1043,18 @@ class PdbTestCase(unittest.TestCase):
self.assertNotIn('Error', stdout.decode(), self.assertNotIn('Error', stdout.decode(),
"Got an error running test script under PDB") "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\nExpected:\n{}\nGot:\n{}\n'
'Fail to handle a syntax error in the debuggee.'
.format(expected, stdout))
def tearDown(self): def tearDown(self):
support.unlink(support.TESTFN) support.unlink(support.TESTFN)
......
...@@ -14,6 +14,9 @@ Core and Builtins ...@@ -14,6 +14,9 @@ Core and Builtins
Library Library
------- -------
- Issue #16180: Exit pdb if file has syntax error, instead of trapping user
in an infinite loop. Patch by Xavier de Gaye.
- Issue #24891: Fix a race condition at Python startup if the file descriptor - Issue #24891: Fix a race condition at Python startup if the file descriptor
of stdin (0), stdout (1) or stderr (2) is closed while Python is creating of stdin (0), stdout (1) or stderr (2) is closed while Python is creating
sys.stdin, sys.stdout and sys.stderr objects. These attributes are now set sys.stdin, sys.stdout and sys.stderr objects. These attributes are now set
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment