mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-110912: Correctly display tracebacks for MemoryError exceptions using the traceback module (#110921)
This commit is contained in:
parent
bad7a35055
commit
b3c9faf056
3 changed files with 14 additions and 4 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue