8000 bpo-39728: Enum: fix duplicate `ValueError` by ethanfurman · Pull Request #22277 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 6 commits into from
Sep 16, 2020

Conversation

ethanfurman
Copy link
Member
@ethanfurman ethanfurman commented Sep 16, 2020

_missing_ should not raise a ValueError when it fails to match, it should return None

https://bugs.python.org/issue39728

Andrey Darascheka and others added 5 commits September 16, 2020 04:38
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
@miss-islington
Copy link
Contributor

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

@miss-islington
Copy link
Contributor

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

@miss-islington
Copy link
Contributor

Sorry, @ethanfurman, I could not cleanly backport this to 3.8 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker c95ad7a91fbd7636f33a098d3b39964ab083bf49 3.8

@miss-islington
Copy link
Contributor
8000 miss-islington commented Sep 16, 2020

Sorry @ethanfurman, I had trouble checking out the 3.9 backport branch.
Please backport using cherry_picker on command line.
cherry_picker c95ad7a91fbd7636f33a098d3b39964ab083bf49 3.9

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>
@bedevere-bot
Copy link

GH-22282 is a backport of this pull request to the 3.9 branch.

@bedevere-bot
Copy link

GH-22283 is a backport of this pull request to the 3.8 branch.

ethanfurman added a commit to ethanfurman/cpython 8000 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>
@ethanfurman ethanfurman deleted the enum-fix_duplicate_valueerror branch April 15, 2021 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0