-
-
You must be signed in to change notification settings -
bpo-39728: Enum: fix duplicate ValueError
#22277
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
bpo-39728: Enum: fix duplicate ValueError
#22277
Conversation
when `_missing_` is called a `ValueError` has occurred, so any exception raised by `_missing_` must have it's context set to that `ValueError`
`_missing_` should return `None` if it cannot match the value; it should not raise a `ValueError` itself -- the method that calls `_missing_` will take care of that
Thanks @ethanfurman for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
Thanks @ethanfurman for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9. |
Sorry, @ethanfurman, I could not cleanly backport this to |
Sorry @ethanfurman, I had trouble checking out the |
fix default `_missing_` to return `None` instead of raising a `ValueError` Co-authored-by: Andrey Darascheka <andrei.daraschenka@leverx.com> (cherry picked from commit c95ad7a) Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
GH-22282 is a backport of this pull request to the 3.9 branch. |
GH-22283 is a backport of this pull request to the 3.8 branch. |
fix default `_missing_` to return `None` instead of raising a `ValueError` Co-authored-by: Andrey Darascheka <andrei.daraschenka@leverx.com>. (cherry picked from commit c95ad7a) Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
fix default `_missing_` to return `None` instead of raising a `ValueError` Co-authored-by: Andrey Darascheka <andrei.daraschenka@leverx.com> (cherry picked from commit c95ad7a) Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
fix default `_missing_` to return `None` instead of raising a `ValueError` Co-authored-by: Andrey Darascheka <andrei.daraschenka@leverx.com>. (cherry picked from commit c95ad7a) Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
fix default `_missing_` to return `None` instead of raising a `ValueError` Co-authored-by: Andrey Darascheka <andrei.daraschenka@leverx.com>
_missing_
should not raise aValueError
when it fails to match, it should returnNone
https://bugs.python.org/issue39728