FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-132308: `TracebackException` swallows attributes of falsey `Exception` and falsey `ExceptionGroup` by YvesDup · Pull Request #132363 · python/cpython · GitHub

Repository navigation

gh-132308: TracebackException swallows attributes of falsey Exception and falsey ExceptionGroup - #132363

Merged
picnixz merged 16 commits into
python:mainfrom
YvesDup:TracebackException-swallows-cause-context-flasey-exception
Apr 19, 2025
Merged

picnixz merged 16 commits into
python:mainfrom
YvesDup:TracebackException-swallows-cause-context-flasey-exception

Conversation

YvesDup commented Apr 10, 2025 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

Summary

An x is falsey if len(x) returns 0 or bool(x) returns False

TracebackException class swallows the following attributes of falsey Exception:

  • __cause__
  • __context__

TracebackException swallows all sub-exceptions of falsey ExceptionGroup

The fix is located in the __init__ method of the TracebackException class.

Comment thread Lib/test/test_traceback.py Outdated
Comment thread Lib/test/test_traceback.py Outdated
Comment thread Lib/test/test_traceback.py Outdated
Comment thread Lib/test/test_traceback.py Outdated
picnixz self-assigned this Apr 19, 2025
picnixz enabled auto-merge (squash) April 19, 2025 08:50
picnixz merged commit 69cda31 into python:main Apr 19, 2025

Copy link
Copy Markdown
Contributor

@picnixz backport to 3.13?

picnixz added the needs backport to 3.13 only security fixes label Apr 19, 2025

Copy link
Copy Markdown

Thanks @YvesDup for the PR, and @picnixz for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

picnixz commented Apr 19, 2025

Copy link
Copy Markdown
Member

Yes, I forgot about it :') Thanks for the reminder

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 19, 2025
…f a falsey `Exception` or `ExceptionGroup` (pythonGH-132363)

(cherry picked from commit 69cda31)

Co-authored-by: Duprat <yduprat@gmail.com>

bedevere-app Bot commented Apr 19, 2025

Copy link
Copy Markdown

GH-132725 is a backport of this pull request to the 3.13 branch.

bedevere-app Bot removed the needs backport to 3.13 only security fixes label Apr 19, 2025

YvesDup commented Apr 29, 2025

Copy link
Copy Markdown
Contributor Author

@picnixz FYI the backport GH-132725 is not merged. Do I wait for to delete my branch ?

picnixz commented Apr 30, 2025

Copy link
Copy Markdown
Member

No it's fine. I'm on my way to the airport, I'll merge it in a few hours. Thanks for the reminder!

picnixz pushed a commit that referenced this pull request Apr 30, 2025
…of a falsey `Exception` or `ExceptionGroup` (GH-132363) (#132725)

gh-132308: prevent `TracebackException` swallowing attributes of a falsey `Exception` or `ExceptionGroup` (GH-132363)
(cherry picked from commit 69cda31)

Co-authored-by: Duprat <yduprat@gmail.com>
YvesDup deleted the TracebackException-swallows-cause-context-flasey-exception branch May 22, 2025 17:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL