From 3e79eaefcfd653af59d82fff23642b5c1fa4ff05 Mon Sep 17 00:00:00 2001 From: "Yves.Duprat" Date: Wed, 9 Apr 2025 19:32:41 +0200 Subject: [PATCH 01/11] Initial commit --- Lib/test/test_traceback.py | 57 ++++++++++++++++++++++++++++++++++++++ Lib/traceback.py | 6 ++-- 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index 5c390fd056b3e3..8d4a082ca3de8e 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -3413,6 +3413,24 @@ class Unrepresentable: def __repr__(self) -> str: raise Exception("Unrepresentable") + +# Used in test_dont_swallow_cause_or_context_of_falsey_exception and +# test_dont_swallow_subexceptions_of_falsey_exceptiongroup. +class FalseyBoolException(Exception): + def __bool__(self): + return False + + +class FalseyLenException(Exception): + def __len__(self): + return 0 + + +class FalseyExceptionGroup(ExceptionGroup): + def __bool__(self): + return False + + class TestTracebackException(unittest.TestCase): def do_test_smoke(self, exc, expected_type_str): try: @@ -3759,6 +3777,26 @@ def f(): 'ZeroDivisionError: division by zero', '']) + def test_dont_swallow_cause_or_context_of_falsey_exception(self): + # see gh-132308: Ensure that __cause__ or __context__ attributes of exceptions + # that evaluate as falsey are included in the output. + # Recall: `x` is falsey if `len(x)` returns 0 or `bool(x)` returns False. + + for exc in (FalseyBoolException, FalseyLenException): + try: + raise exc(0) from KeyError + except exc as e: + self.assertIn(cause_message, traceback.format_exception(e)) + + for exc in (FalseyBoolException, FalseyLenException): + try: + try: + 1/0 + except: + raise exc(1) + except exc as e: + self.assertIn(context_message, traceback.format_exception(e)) + class TestTracebackException_ExceptionGroups(unittest.TestCase): def setUp(self): @@ -3960,6 +3998,25 @@ def test_comparison(self): self.assertNotEqual(exc, object()) self.assertEqual(exc, ALWAYS_EQ) + def test_dont_swallow_subexceptions_of_falsey_exceptiongroup(self): + # see gh-132308: Ensure that subexceptions of exception group + # that evaluate as falsey are displayed in the output. + # Recall: `x` is falsey if `len(x)` returns 0 or `bool(x)` returns False. + + try: + raise FalseyExceptionGroup("Gih", (KeyError(2), NameError('Guh'))) + except Exception as ee: + str_exc = ''.join(traceback.format_exception(ee)) + self.assertIn('+---------------- 1 ----------------', str_exc) + self.assertIn('+---------------- 2 ----------------', str_exc) + + # Test with a falsey exception, in last position, as sub-exceptions. + msg = 'bool' + try: + raise FalseyExceptionGroup("Gih", (KeyError(2), FalseyBoolException(msg))) + except Exception as ee: + str_exc = traceback.format_exception(ee) + self.assertIn(f'{FalseyBoolException.__name__}: {msg}', str_exc[-2]) global_for_suggestions = None diff --git a/Lib/traceback.py b/Lib/traceback.py index 647c23ed782c41..78c35136ea9e8c 100644 --- a/Lib/traceback.py +++ b/Lib/traceback.py @@ -1120,7 +1120,7 @@ def __init__(self, exc_type, exc_value, exc_traceback, *, limit=None, queue = [(self, exc_value)] while queue: te, e = queue.pop() - if (e and e.__cause__ is not None + if (e is not None and e.__cause__ is not None and id(e.__cause__) not in _seen): cause = TracebackException( type(e.__cause__), @@ -1141,7 +1141,7 @@ def __init__(self, exc_type, exc_value, exc_traceback, *, limit=None, not e.__suppress_context__) else: need_context = True - if (e and e.__context__ is not None + if (e is not None and e.__context__ is not None and need_context and id(e.__context__) not in _seen): context = TracebackException( type(e.__context__), @@ -1156,7 +1156,7 @@ def __init__(self, exc_type, exc_value, exc_traceback, *, limit=None, else: context = None - if e and isinstance(e, BaseExceptionGroup): + if e is not None and isinstance(e, BaseExceptionGroup): exceptions = [] for exc in e.exceptions: texc = TracebackException( From b7560437b2dba7ce9e7a0abf53ed302eca6f8787 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 13:06:47 +0000 Subject: [PATCH 02/11] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20b?= =?UTF-8?q?lurb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst diff --git a/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst b/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst new file mode 100644 index 00000000000000..83f7883dff5bad --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst @@ -0,0 +1 @@ +Prevent attributes of exceptions or exception groups that evaluate as falsey (namely, when their ``__bool__`` method returns ``False`` or their ``__len__`` method returns 0) from being ignored by the :class:`traceback.TracebackException'. From 8223c0a88689ce4d541fc8887cab1f923a9c8223 Mon Sep 17 00:00:00 2001 From: Duprat Date: Thu, 10 Apr 2025 15:10:35 +0200 Subject: [PATCH 03/11] Fix nits --- .../next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst b/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst index 83f7883dff5bad..56407447dc29cb 100644 --- a/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst +++ b/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst @@ -1 +1 @@ -Prevent attributes of exceptions or exception groups that evaluate as falsey (namely, when their ``__bool__`` method returns ``False`` or their ``__len__`` method returns 0) from being ignored by the :class:`traceback.TracebackException'. +Prevent attributes of exceptions or exception groups that evaluate as falsey (namely, when their ``__bool__`` method returns ``False`` or their ``__len__`` method returns 0) from being ignored by the :class:`traceback.TracebackException`. From 5337df3eab13ff1557f879d292f499fe73936ba3 Mon Sep 17 00:00:00 2001 From: Duprat Date: Fri, 11 Apr 2025 00:33:46 +0200 Subject: [PATCH 04/11] Rewrite news --- .../Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst b/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst index 56407447dc29cb..04ae6941584292 100644 --- a/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst +++ b/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst @@ -1 +1,3 @@ -Prevent attributes of exceptions or exception groups that evaluate as falsey (namely, when their ``__bool__`` method returns ``False`` or their ``__len__`` method returns 0) from being ignored by the :class:`traceback.TracebackException`. +The class:`traceback.TracebackException` must include the `__context__`, `__cause__` attributes +from falsey Exception, and the `exceptions` attribute from falsey ExceptionGroup' in its render. +For remind: ``x`` is falsey if ``len(x)`` returns 0 or ``bool(x)`` returns False. From ad588cf116d5bd187d65854d3e858f9c09efa1bb Mon Sep 17 00:00:00 2001 From: "Yves.Duprat" Date: Fri, 11 Apr 2025 00:29:04 +0200 Subject: [PATCH 05/11] Removing unnecessary parameters --- Lib/test/test_traceback.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index 8d4a082ca3de8e..d1a549394b4bb3 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -3784,7 +3784,7 @@ def test_dont_swallow_cause_or_context_of_falsey_exception(self): for exc in (FalseyBoolException, FalseyLenException): try: - raise exc(0) from KeyError + raise exc from KeyError except exc as e: self.assertIn(cause_message, traceback.format_exception(e)) @@ -3793,7 +3793,7 @@ def test_dont_swallow_cause_or_context_of_falsey_exception(self): try: 1/0 except: - raise exc(1) + raise exc except exc as e: self.assertIn(context_message, traceback.format_exception(e)) @@ -4004,7 +4004,7 @@ def test_dont_swallow_subexceptions_of_falsey_exceptiongroup(self): # Recall: `x` is falsey if `len(x)` returns 0 or `bool(x)` returns False. try: - raise FalseyExceptionGroup("Gih", (KeyError(2), NameError('Guh'))) + raise FalseyExceptionGroup("Gih", (KeyError(), NameError())) except Exception as ee: str_exc = ''.join(traceback.format_exception(ee)) self.assertIn('+---------------- 1 ----------------', str_exc) @@ -4013,11 +4013,12 @@ def test_dont_swallow_subexceptions_of_falsey_exceptiongroup(self): # Test with a falsey exception, in last position, as sub-exceptions. msg = 'bool' try: - raise FalseyExceptionGroup("Gih", (KeyError(2), FalseyBoolException(msg))) + raise FalseyExceptionGroup("Gah", (KeyError(), FalseyBoolException(msg))) except Exception as ee: str_exc = traceback.format_exception(ee) self.assertIn(f'{FalseyBoolException.__name__}: {msg}', str_exc[-2]) + global_for_suggestions = None From 3f59327a5b080bad8757fe48a3b87e5180cfc124 Mon Sep 17 00:00:00 2001 From: Duprat Date: Fri, 11 Apr 2025 00:39:36 +0200 Subject: [PATCH 06/11] Fix nits --- .../Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst b/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst index 04ae6941584292..075d1276fc445d 100644 --- a/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst +++ b/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst @@ -1,3 +1,3 @@ -The class:`traceback.TracebackException` must include the `__context__`, `__cause__` attributes -from falsey Exception, and the `exceptions` attribute from falsey ExceptionGroup' in its render. +The class:`traceback.TracebackException` must include the ``__context__``, ``__cause__`` attributes +from falsey Exception, and the ``exceptions`` attribute from falsey ``ExceptionGroup`` in its render. For remind: ``x`` is falsey if ``len(x)`` returns 0 or ``bool(x)`` returns False. From 155f77cd8a4045c3c4bafbf498c8767455d2a79a Mon Sep 17 00:00:00 2001 From: "Yves.Duprat" Date: Fri, 11 Apr 2025 14:06:56 +0200 Subject: [PATCH 07/11] Last nits --- .../next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst b/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst index 075d1276fc445d..0835be5f6404a1 100644 --- a/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst +++ b/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst @@ -1,3 +1,3 @@ -The class:`traceback.TracebackException` must include the ``__context__``, ``__cause__`` attributes +The :class:`traceback.TracebackException` must include the ``__context__``, ``__cause__`` attributes from falsey Exception, and the ``exceptions`` attribute from falsey ``ExceptionGroup`` in its render. For remind: ``x`` is falsey if ``len(x)`` returns 0 or ``bool(x)`` returns False. From cc1ba3279f2430e09cc861d097c02e6ea47ec1c3 Mon Sep 17 00:00:00 2001 From: "Yves.Duprat" Date: Fri, 18 Apr 2025 16:09:30 +0200 Subject: [PATCH 08/11] Fix comments --- Lib/test/test_traceback.py | 40 +++++++++++-------- ...-04-10-13-06-42.gh-issue-132308.1js5SI.rst | 1 - 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index d1a549394b4bb3..9f99d9bb38421a 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -3426,11 +3426,16 @@ def __len__(self): return 0 -class FalseyExceptionGroup(ExceptionGroup): +class FalseyBoolExceptionGroup(ExceptionGroup): def __bool__(self): return False +class FalseyLenExceptionGroup(ExceptionGroup): + def __len__(self): + return 0 + + class TestTracebackException(unittest.TestCase): def do_test_smoke(self, exc, expected_type_str): try: @@ -3792,7 +3797,7 @@ def test_dont_swallow_cause_or_context_of_falsey_exception(self): try: try: 1/0 - except: + except ZeroDivisionError: raise exc except exc as e: self.assertIn(context_message, traceback.format_exception(e)) @@ -3999,24 +4004,25 @@ def test_comparison(self): self.assertEqual(exc, ALWAYS_EQ) def test_dont_swallow_subexceptions_of_falsey_exceptiongroup(self): - # see gh-132308: Ensure that subexceptions of exception group + # see gh-132308: Ensure that subexceptions of exception groups # that evaluate as falsey are displayed in the output. # Recall: `x` is falsey if `len(x)` returns 0 or `bool(x)` returns False. - try: - raise FalseyExceptionGroup("Gih", (KeyError(), NameError())) - except Exception as ee: - str_exc = ''.join(traceback.format_exception(ee)) - self.assertIn('+---------------- 1 ----------------', str_exc) - self.assertIn('+---------------- 2 ----------------', str_exc) - - # Test with a falsey exception, in last position, as sub-exceptions. - msg = 'bool' - try: - raise FalseyExceptionGroup("Gah", (KeyError(), FalseyBoolException(msg))) - except Exception as ee: - str_exc = traceback.format_exception(ee) - self.assertIn(f'{FalseyBoolException.__name__}: {msg}', str_exc[-2]) + for falsey_exception in (FalseyBoolExceptionGroup, FalseyLenExceptionGroup): + try: + raise falsey_exception("Gih", (KeyError(), NameError())) + except Exception as ee: + str_exc = ''.join(traceback.format_exception(ee)) + self.assertIn('+---------------- 1 ----------------', str_exc) + self.assertIn('+---------------- 2 ----------------', str_exc) + + # Test with a falsey exception, in last position, as sub-exceptions. + msg = 'bool' + try: + raise falsey_exception("Gah", (KeyError(), FalseyBoolException(msg))) + except Exception as ee: + str_exc = traceback.format_exception(ee) + self.assertIn(f'{FalseyBoolException.__name__}: {msg}', str_exc[-2]) global_for_suggestions = None diff --git a/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst b/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst index 0835be5f6404a1..33a74c0a3a4539 100644 --- a/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst +++ b/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst @@ -1,3 +1,2 @@ The :class:`traceback.TracebackException` must include the ``__context__``, ``__cause__`` attributes from falsey Exception, and the ``exceptions`` attribute from falsey ``ExceptionGroup`` in its render. -For remind: ``x`` is falsey if ``len(x)`` returns 0 or ``bool(x)`` returns False. From d78095a7fbbb768a8842188ab1a6aa47f8af0bf8 Mon Sep 17 00:00:00 2001 From: "Yves.Duprat" Date: Fri, 18 Apr 2025 18:57:57 +0200 Subject: [PATCH 09/11] Fix last comments --- Lib/test/test_traceback.py | 73 ++++++++----------- ...-04-10-13-06-42.gh-issue-132308.1js5SI.rst | 1 + 2 files changed, 31 insertions(+), 43 deletions(-) diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index 9f99d9bb38421a..a806dbf1582268 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -3416,26 +3416,16 @@ def __repr__(self) -> str: # Used in test_dont_swallow_cause_or_context_of_falsey_exception and # test_dont_swallow_subexceptions_of_falsey_exceptiongroup. -class FalseyBoolException(Exception): +class FalseyException(Exception): def __bool__(self): return False -class FalseyLenException(Exception): - def __len__(self): - return 0 - - -class FalseyBoolExceptionGroup(ExceptionGroup): +class FalseyExceptionGroup(ExceptionGroup): def __bool__(self): return False -class FalseyLenExceptionGroup(ExceptionGroup): - def __len__(self): - return 0 - - class TestTracebackException(unittest.TestCase): def do_test_smoke(self, exc, expected_type_str): try: @@ -3784,23 +3774,21 @@ def f(): def test_dont_swallow_cause_or_context_of_falsey_exception(self): # see gh-132308: Ensure that __cause__ or __context__ attributes of exceptions - # that evaluate as falsey are included in the output. - # Recall: `x` is falsey if `len(x)` returns 0 or `bool(x)` returns False. + # that evaluate as falsey are included in the output. For falsey term, + # see https://docs.python.org/3/library/stdtypes.html#truth-value-testing. - for exc in (FalseyBoolException, FalseyLenException): - try: - raise exc from KeyError - except exc as e: - self.assertIn(cause_message, traceback.format_exception(e)) + try: + raise FalseyException from KeyError + except FalseyException as e: + self.assertIn(cause_message, traceback.format_exception(e)) - for exc in (FalseyBoolException, FalseyLenException): + try: try: - try: - 1/0 - except ZeroDivisionError: - raise exc - except exc as e: - self.assertIn(context_message, traceback.format_exception(e)) + 1/0 + except ZeroDivisionError: + raise FalseyException + except FalseyException as e: + self.assertIn(context_message, traceback.format_exception(e)) class TestTracebackException_ExceptionGroups(unittest.TestCase): @@ -4005,24 +3993,23 @@ def test_comparison(self): def test_dont_swallow_subexceptions_of_falsey_exceptiongroup(self): # see gh-132308: Ensure that subexceptions of exception groups - # that evaluate as falsey are displayed in the output. - # Recall: `x` is falsey if `len(x)` returns 0 or `bool(x)` returns False. + # that evaluate as falsey are displayed in the output. For falsey term, + # see https://docs.python.org/3/library/stdtypes.html#truth-value-testing. - for falsey_exception in (FalseyBoolExceptionGroup, FalseyLenExceptionGroup): - try: - raise falsey_exception("Gih", (KeyError(), NameError())) - except Exception as ee: - str_exc = ''.join(traceback.format_exception(ee)) - self.assertIn('+---------------- 1 ----------------', str_exc) - self.assertIn('+---------------- 2 ----------------', str_exc) - - # Test with a falsey exception, in last position, as sub-exceptions. - msg = 'bool' - try: - raise falsey_exception("Gah", (KeyError(), FalseyBoolException(msg))) - except Exception as ee: - str_exc = traceback.format_exception(ee) - self.assertIn(f'{FalseyBoolException.__name__}: {msg}', str_exc[-2]) + try: + raise FalseyExceptionGroup("Gih", (KeyError(), NameError())) + except Exception as ee: + str_exc = ''.join(traceback.format_exception(ee)) + self.assertIn('+---------------- 1 ----------------', str_exc) + self.assertIn('+---------------- 2 ----------------', str_exc) + + # Test with a falsey exception, in last position, as sub-exceptions. + msg = 'bool' + try: + raise FalseyExceptionGroup("Gah", (KeyError(), FalseyException(msg))) + except Exception as ee: + str_exc = traceback.format_exception(ee) + self.assertIn(f'{FalseyException.__name__}: {msg}', str_exc[-2]) global_for_suggestions = None diff --git a/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst b/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst index 33a74c0a3a4539..f8b6c35b152fd6 100644 --- a/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst +++ b/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst @@ -1,2 +1,3 @@ The :class:`traceback.TracebackException` must include the ``__context__``, ``__cause__`` attributes from falsey Exception, and the ``exceptions`` attribute from falsey ``ExceptionGroup`` in its render. +For *falsey* term, see https://docs.python.org/3/library/stdtypes.html#truth-value-testing. From a2108dad7eda7797cf1b1fe8a09c2b7fa8a24701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Sat, 19 Apr 2025 10:48:52 +0200 Subject: [PATCH 10/11] Update Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst --- .../Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst b/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst index f8b6c35b152fd6..1bee9c4c8b2dcd 100644 --- a/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst +++ b/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst @@ -1,3 +1,3 @@ -The :class:`traceback.TracebackException` must include the ``__context__``, ``__cause__`` attributes -from falsey Exception, and the ``exceptions`` attribute from falsey ``ExceptionGroup`` in its render. -For *falsey* term, see https://docs.python.org/3/library/stdtypes.html#truth-value-testing. +A :class:`traceback.TracebackException` now correctly renders the ``__context__`` +and ``__cause__`` attributes from :ref:`falsey ` :class:`Exception`, +and the ``exceptions`` attribute from falsey :class:`ExceptionGroup`. From 2405f1fbfa73a1169670ed569ea74bb72a47227e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Sat, 19 Apr 2025 11:25:43 +0200 Subject: [PATCH 11/11] Update Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst --- .../next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst b/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst index 1bee9c4c8b2dcd..8e8b99c2be31ec 100644 --- a/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst +++ b/Misc/NEWS.d/next/Library/2025-04-10-13-06-42.gh-issue-132308.1js5SI.rst @@ -1,3 +1,3 @@ A :class:`traceback.TracebackException` now correctly renders the ``__context__`` -and ``__cause__`` attributes from :ref:`falsey ` :class:`Exception`, +and ``__cause__`` attributes from :ref:`falsey ` :class:`Exception`, and the ``exceptions`` attribute from falsey :class:`ExceptionGroup`.