summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_traceback.py
diff options
context:
space:
mode:
authorBatuhan Taskaya <batuhan@python.org>2021-07-24 12:50:19 (GMT)
committerGitHub <noreply@github.com>2021-07-24 12:50:19 (GMT)
commitc8362314cce53a5b59da7523fbdfa00f122aa319 (patch)
tree5d2df73bd5b7ac436b1fbb15242e4bed12ce5476 /Lib/test/test_traceback.py
parenta22b05da87bdfb081d6aaecfce136ae8dbb8680c (diff)
downloadcpython-c8362314cce53a5b59da7523fbdfa00f122aa319.zip
cpython-c8362314cce53a5b59da7523fbdfa00f122aa319.tar.gz
cpython-c8362314cce53a5b59da7523fbdfa00f122aa319.tar.bz2
bpo-43950: ensure source_line is present when specialising the traceback (GH-27313)
Diffstat (limited to 'Lib/test/test_traceback.py')
-rw-r--r--Lib/test/test_traceback.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py
index 4742eb1..c87ce72 100644
--- a/Lib/test/test_traceback.py
+++ b/Lib/test/test_traceback.py
@@ -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)