bpo-39728: Enum: fix duplicate ValueError#22277
Merged
ethanfurman merged 6 commits intopython:masterfrom Sep 16, 2020
Merged
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
Contributor
|
Thanks @ethanfurman for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
Contributor
|
Thanks @ethanfurman for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9. |
Contributor
|
Sorry, @ethanfurman, I could not cleanly backport this to |
Contributor
|
Sorry @ethanfurman, I had trouble checking out the |
ethanfurman
added a commit
to ethanfurman/cpython
that referenced
this pull request
Sep 16, 2020
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. |
ethanfurman
added a commit
to ethanfurman/cpython
that referenced
this pull request
Sep 16, 2020
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>
ethanfurman
added a commit
that referenced
this pull request
Sep 17, 2020
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>
ethanfurman
added a commit
that referenced
this pull request
Sep 17, 2020
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>
xzy3
pushed a commit
to xzy3/cpython
that referenced
this pull request
Oct 18, 2020
fix default `_missing_` to return `None` instead of raising a `ValueError` Co-authored-by: Andrey Darascheka <andrei.daraschenka@leverx.com>
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_missing_should not raise aValueErrorwhen it fails to match, it should returnNonehttps://bugs.python.org/issue39728