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

Avoid exception normalisation of unused exception instances during "except" handling #6602

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

scoder
Copy link
Contributor

@scoder scoder commented Jan 7, 2025

Closes #6601

@@ -460,6 +460,7 @@ def complex_finally_clause(x, obj):
Traceback (most recent call last):
TypeError
"""
a = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understand what this is doing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The C compiler cannot see through Python context managers, so without this pre-initialisation, it may issue a warning about uninitialised usage. I'll push the change separately.

@da-woods
Copy link
Contributor

da-woods commented Jan 7, 2025

It looks reasonable to me. I may try to expand is_body_trivial a bit as a follow up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ENH] Eliminate exception getting for trivial except clauses
2 participants