mirror of
https://github.com/python/cpython.git
synced 2025-10-09 08:31:26 +00:00
bpo-43950: ensure source_line is present when specialising the traceback (GH-27313)
This commit is contained in:
parent
a22b05da87
commit
c8362314cc
2 changed files with 27 additions and 2 deletions
|
@ -121,6 +121,31 @@ class TracebackCases(unittest.TestCase):
|
|||
finally:
|
||||
unlink(TESTFN)
|
||||
|
||||
def test_recursion_error_during_traceback(self):
|
||||
code = textwrap.dedent("""
|
||||
import sys
|
||||
from weakref import ref
|
||||
|
||||
sys.setrecursionlimit(15)
|
||||
|
||||
def f():
|
||||
ref(lambda: 0, [])
|
||||
f()
|
||||
|
||||
try:
|
||||
f()
|
||||
except RecursionError:
|
||||
pass
|
||||
""")
|
||||
try:
|
||||
with open(TESTFN, 'w') as f:
|
||||
f.write(code)
|
||||
|
||||
rc, _, _ = assert_python_ok(TESTFN)
|
||||
self.assertEqual(rc, 0)
|
||||
finally:
|
||||
unlink(TESTFN)
|
||||
|
||||
def test_bad_indentation(self):
|
||||
err = self.get_exception_format(self.syntax_error_bad_indentation,
|
||||
IndentationError)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue