summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2023-10-16 14:39:23 (GMT)
committerGitHub <noreply@github.com>2023-10-16 14:39:23 (GMT)
commitb3c9faf056e7d642785a8cfd53d1184b37a74a69 (patch)
treec5b28ce7d3739b7968cd00465feb7683dc1f6961 /Lib/test
parentbad7a35055dbe9e6297110eb8c72eb8edfefd42d (diff)
downloadcpython-b3c9faf056e7d642785a8cfd53d1184b37a74a69.zip
cpython-b3c9faf056e7d642785a8cfd53d1184b37a74a69.tar.gz
cpython-b3c9faf056e7d642785a8cfd53d1184b37a74a69.tar.bz2
gh-110912: Correctly display tracebacks for MemoryError exceptions using the traceback module (#110921)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_traceback.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py
index 9bb1786..a0f7ad8 100644
--- a/Lib/test/test_traceback.py
+++ b/Lib/test/test_traceback.py
@@ -927,6 +927,17 @@ class TracebackErrorLocationCaretTestBase:
]
self.assertEqual(actual, expected)
+ def test_memory_error(self):
+ def f():
+ raise MemoryError()
+
+ actual = self.get_exception(f)
+ expected = ['Traceback (most recent call last):',
+ f' File "{__file__}", line {self.callable_line}, in get_exception',
+ ' callable()',
+ f' File "{__file__}", line {f.__code__.co_firstlineno + 1}, in f',
+ ' raise MemoryError()']
+ self.assertEqual(actual, expected)
@requires_debug_ranges()