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

[3.12] gh-104271: Fix auto() fallback in case of mixed type Enum #104279

Merged
merged 3 commits into from
May 23, 2023

Conversation

itamaro
Copy link
Contributor

@itamaro itamaro commented May 7, 2023

gh-91457 changed the behavior of auto() in case of mixed type Enums.
the fallback behavior (before deprecation) was supposed to be backwards compatible (I think), but iterating the sorted last_values in order (instead of reversed order) results an incorrect behavior of always reusing values after the first auto(), as demonstrated in the test case I extended in this PR.

@itamaro itamaro requested a review from ethanfurman as a code owner May 7, 2023 21:16
@ethanfurman ethanfurman self-assigned this May 23, 2023
@ethanfurman ethanfurman added stdlib Python modules in the Lib dir 3.11 only security fixes 3.12 bugs and security fixes needs backport to 3.11 only security fixes labels May 23, 2023
@ethanfurman ethanfurman changed the title gh-104271: Fix auto() fallback in case of mixed type Enum [3.12] gh-104271: Fix auto() fallback in case of mixed type Enum May 23, 2023
@ethanfurman ethanfurman changed the base branch from main to 3.12 May 23, 2023 01:02
@ethanfurman ethanfurman merged commit f4e2049 into python:3.12 May 23, 2023
@miss-islington
Copy link
Contributor

Thanks @itamaro for the PR, and @ethanfurman for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry @itamaro and @ethanfurman, I had trouble checking out the 3.11 backport branch.
Please retry by removing and re-adding the "needs backport to 3.11" label.
Alternatively, you can backport using cherry_picker on the command line.
cherry_picker f4e2049f14d40c1b893c68530eec5e341cf3d929 3.11

@itamaro
Copy link
Contributor Author

itamaro commented May 23, 2023

@ethanfurman how do we port it also to main branch now? should it be a new PR for main?

@ethanfurman
Copy link
Member

It doesn't need to go in main (which is now 3.13) because mixed types are no longer supported by the default _generate_next_value_().

@ethanfurman ethanfurman added needs backport to 3.11 only security fixes and removed needs backport to 3.11 only security fixes labels May 23, 2023
@miss-islington
Copy link
Contributor

Thanks @itamaro for the PR, and @ethanfurman for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-104809 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label May 23, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 23, 2023
pythonGH-104279)

(cherry picked from commit f4e2049)

Co-authored-by: Itamar Ostricher <itamarost@gmail.com>
pythongh-104271: Fix auto() fallback in case of mixed type Enum
ethanfurman pushed a commit that referenced this pull request May 23, 2023
…104809)

[3.12] gh-104271: Fix auto() fallback in case of mixed type Enum (GH-104279)
(cherry picked from commit f4e2049)

Co-authored-by: Itamar Ostricher <itamarost@gmail.com>
@itamaro itamaro deleted the gh-104271 branch April 9, 2024 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes 3.12 bugs and security fixes skip news stdlib Python modules in the Lib dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants