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

gh-109022: [Enum] require names=() to create empty enum type #109048

Merged
merged 3 commits into from
Sep 8, 2023

Conversation

ethanfurman
Copy link
Member

@ethanfurman ethanfurman commented Sep 7, 2023

add guard so that Enum('bar') raises a ValueError instead of creating a new enum class called bar. To create the new but empty class, use:

huh = Enum('bar', names=())

add guard so that ``Enum('bar')`` raises a ValueError instead of
creating a new enum class called `bar`.  To create the new but
empty class, use:

    huh = Enum('bar', names=())
@ethanfurman ethanfurman added type-bug An unexpected behavior, bug, or error 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 3.13 bugs and security fixes needs backport to 3.12 bug and security fixes labels Sep 7, 2023
@ethanfurman ethanfurman requested a review from Yhg1s September 7, 2023 02:53
@ethanfurman ethanfurman self-assigned this Sep 7, 2023
@ethanfurman ethanfurman changed the title [Enum] require names=() to create empty enum type gh-109022: [Enum] require names=() to create empty enum type Sep 7, 2023
@ethanfurman ethanfurman removed the request for review from Yhg1s September 7, 2023 19:27
@ethanfurman ethanfurman added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Sep 7, 2023
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @ethanfurman for commit d7a9f2f 🤖

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Sep 7, 2023
@ethanfurman ethanfurman merged commit c74e440 into python:main Sep 8, 2023
@miss-islington
Copy link
Contributor

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

@miss-islington
Copy link
Contributor

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 8, 2023
…ythonGH-109048)

add guard so that ``Enum('bar')`` raises a TypeError instead of
creating a new enum class called `bar`.  To create the new but
empty class, use:

    huh = Enum('bar', names=())
(cherry picked from commit c74e440)

Co-authored-by: Ethan Furman <[email protected]>
@bedevere-bot
Copy link

GH-109122 is a backport of this pull request to the 3.12 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.12 bug and security fixes label Sep 8, 2023
@ethanfurman ethanfurman removed 3.11 only security fixes needs backport to 3.11 only security fixes labels Sep 8, 2023
@ethanfurman ethanfurman deleted the enum-109022 branch September 8, 2023 01:58
Yhg1s pushed a commit that referenced this pull request Sep 12, 2023
…GH-109048) (#109122)

gh-109022: [Enum] require `names=()` to create empty enum type (GH-109048)

add guard so that ``Enum('bar')`` raises a TypeError instead of
creating a new enum class called `bar`.  To create the new but
empty class, use:

    huh = Enum('bar', names=())
(cherry picked from commit c74e440)

Co-authored-by: Ethan Furman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants