diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2023-03-21 09:36:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-21 09:36:18 (GMT) |
commit | 5c471f3f2a74f4ae7764ed025d2ef077d692d608 (patch) | |
tree | 05ac6d97cf12070adf7d5512a6e913c0a9c0f290 /Lib/test | |
parent | 82eb9469e717e0047543732287a8342e646c2262 (diff) | |
download | cpython-5c471f3f2a74f4ae7764ed025d2ef077d692d608.zip cpython-5c471f3f2a74f4ae7764ed025d2ef077d692d608.tar.gz cpython-5c471f3f2a74f4ae7764ed025d2ef077d692d608.tar.bz2 |
gh-102755: PyErr_DisplayException only in ABI >= 3.12. Tests cover PyErr_Display as well (GH-102849)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_traceback.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index 1c5d1ab..399c59f 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -394,6 +394,8 @@ class PurePythonExceptionFormattingMixin: class CAPIExceptionFormattingMixin: + LEGACY = 0 + def get_exception(self, callable, slice_start=0, slice_end=-1): from _testcapi import exception_print try: @@ -401,11 +403,13 @@ class CAPIExceptionFormattingMixin: self.fail("No exception thrown.") except Exception as e: with captured_output("stderr") as tbstderr: - exception_print(e) + exception_print(e, self.LEGACY) return tbstderr.getvalue().splitlines()[slice_start:slice_end] callable_line = get_exception.__code__.co_firstlineno + 3 +class CAPIExceptionFormattingLegacyMixin(CAPIExceptionFormattingMixin): + LEGACY = 1 @requires_debug_ranges() class TracebackErrorLocationCaretTestBase: @@ -912,6 +916,16 @@ class CPythonTracebackErrorCaretTests( Same set of tests as above but with Python's internal traceback printing. """ +@cpython_only +@requires_debug_ranges() +class CPythonTracebackErrorCaretTests( + CAPIExceptionFormattingLegacyMixin, + TracebackErrorLocationCaretTestBase, + unittest.TestCase, +): + """ + Same set of tests as above but with Python's legacy internal traceback printing. + """ class TracebackFormatTests(unittest.TestCase): |