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

[Enum] update class creation for RuntimeError changes #111815

Merged
merged 2 commits into from
Nov 29, 2023

Conversation

ethanfurman
Copy link
Member

@ethanfurman ethanfurman commented Nov 7, 2023

prior to 3.12, an error that occurred during class creation, i.e.

enum_class = super().__new__(metacls, cls, bases, classdict, **kwds)

resulted in a RuntimeError being raised with the original exception as the cause.

In 3.12, the original error is propagated with an extra line

Error calling __set_name__ on '_proto_member' instance ...

To discard that noise, the raised exception is recreated before being raised.


📚 Documentation preview 📚: https://cpython-previews--111815.org.readthedocs.build/

prior to 3.12, an error that occurred during class creation, i.e.

    enum_class = super().__new__(metacls, cls, bases, classdict, **kwds)

resulted in a RuntimeError being raised with the original exception as
the __cause__.

In 3.12, the original error is propagated with an extra line

    Error calling __set_name__ on '_proto_member' instance ...

To discard that noise, the raised exception is recreated before being
raised.
@ethanfurman ethanfurman added type-bug An unexpected behavior, bug, or error docs Documentation in the Doc dir skip issue skip news stdlib Python modules in the Lib dir 3.12 bugs and security fixes 3.13 bugs and security fixes needs backport to 3.12 bug and security fixes labels Nov 7, 2023
@ethanfurman ethanfurman self-assigned this Nov 7, 2023
Copy link

@touero touero left a comment

Choose a reason for hiding this comment

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

pending

Lib/enum.py Show resolved Hide resolved
Lib/enum.py Show resolved Hide resolved
@ethanfurman ethanfurman merged commit f9e6ce0 into python:main Nov 29, 2023
@miss-islington-app
Copy link

Thanks @ethanfurman for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@ethanfurman ethanfurman added needs backport to 3.12 bug and security fixes and removed needs backport to 3.12 bug and security fixes labels Nov 29, 2023
@miss-islington-app
Copy link

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

@hugovk hugovk added needs backport to 3.12 bug and security fixes and removed needs backport to 3.12 bug and security fixes labels Nov 29, 2023
@miss-islington-app
Copy link

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 29, 2023
(cherry picked from commit f9e6ce0)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
@bedevere-app
Copy link

bedevere-app bot commented Nov 29, 2023

GH-112526 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Nov 29, 2023
@ethanfurman ethanfurman deleted the enum-runtimeerror branch November 29, 2023 21:44
ethanfurman added a commit that referenced this pull request Nov 29, 2023
…) (GH-112526)

(cherry picked from commit f9e6ce0)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes docs Documentation in the Doc dir skip issue skip news stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants