← 返回首页
[3.12] gh-104271: Fix auto() fallback in case of mixed type Enum by itamaro · Pull Request #104279 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

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

Merged
ethanfurman merged 3 commits into
python:3.12from
itamaro:gh-104271
May 23, 2023
Merged

[3.12] gh-104271: Fix auto() fallback in case of mixed type Enum#104279
ethanfurman merged 3 commits into
python:3.12from
itamaro:gh-104271

Conversation

itamaro commented May 7, 2023
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Contributor

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 requested a review from ethanfurman as a code owner May 7, 2023 21:16
ethanfurman self-assigned this May 23, 2023
ethanfurman 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
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 changed the base branch from main to 3.12 May 23, 2023 01:02
ethanfurman merged commit f4e2049 into python:3.12 May 23, 2023

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
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 commented May 23, 2023

Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
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 added needs backport to 3.11 only security fixes and removed needs backport to 3.11 only security fixes labels May 23, 2023

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown

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

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 deleted the gh-104271 branch April 9, 2024 15:29
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

Labels

3.11 only security fixes 3.12 only security fixes skip news stdlib Standard Library Python modules in the Lib/ directory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Footer

© 2026 GitHub, Inc.