Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-99181: fix except* on unhashable exceptions #99192

Merged
merged 6 commits into from
Nov 8, 2022

Conversation

iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Nov 7, 2022

Fixes #99181.

The fix is for the internal split/merge that except* uses to be based on a set of the IDs of the exceptions rather than a set of the exception objects themselves. This also protects against exceptions with crazy __eq__ implementations (the new tests check for this too).

@iritkatriel iritkatriel added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 7, 2022
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit 47842ab 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 7, 2022
@iritkatriel iritkatriel added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 7, 2022
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit 9f8a78d 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 7, 2022
@JelleZijlstra JelleZijlstra self-requested a review November 7, 2022 18:29
Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the ids here seems safe because they are used only while the code holds a reference to the BaseExceptionGroup object and that object is immutable, so there's no chance that the ids will get reused while the code is running.

@iritkatriel iritkatriel merged commit c43714f into python:main Nov 8, 2022
@miss-islington
Copy link
Contributor

Thanks @iritkatriel for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 8, 2022
@bedevere-bot
Copy link

GH-99243 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Nov 8, 2022
miss-islington added a commit that referenced this pull request Nov 8, 2022
(cherry picked from commit c43714f)

Co-authored-by: Irit Katriel <[email protected]>
@iritkatriel iritkatriel deleted the unhashable branch December 7, 2022 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError when except* catches an unhashable exception
5 participants