Skip to content

Conversation

@itamaro
Copy link
Contributor

@itamaroitamaro 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.

@itamaroitamaro requested a review from ethanfurman as a code ownerMay 7, 2023 21:16
@ethanfurmanethanfurman self-assigned this May 23, 2023
@ethanfurmanethanfurman added stdlib Standard Library Python modules in the Lib/ directory 3.11 only security fixes 3.12 only security fixes needs backport to 3.11 only security fixes labels May 23, 2023
@ethanfurmanethanfurman 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 EnumMay 23, 2023
@ethanfurmanethanfurman changed the base branch from main to 3.12May 23, 2023 01:02
@ethanfurmanethanfurman merged commit f4e2049 into python:3.12May 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
ContributorAuthor

@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_().

@ethanfurmanethanfurman 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-botbedevere-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>
@itamaroitamaro deleted the gh-104271 branch April 9, 2024 15:29
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.11only security fixes3.12only security fixesskip newsstdlibStandard Library Python modules in the Lib/ directory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@itamaro@miss-islington@ethanfurman@bedevere-bot