Sitelet https://github.com/python/cpython/issues/100039
Skip to content

[Enum] __text_signature__ of EnumType.__call__ and derivatives #100039

Description

@ethanfurman

EnumType.__call__ is a dual-purpose method:

  • create a new enum class (functional API, and only valid if the parent enum has no members)
  • look up an existing member (only valid if enum has members)

Enhancement: Have the appropriate __text_signature__ set for each enum/flag.

Linked PRs

Activity

  1. added
    type-featureA feature request or enhancement
    stdlibStandard Library Python modules in the Lib/ directory
    3.12only security fixes
    on Dec 5, 2022
  2. self-assigned this
    on Dec 5, 2022
  3. ethanfurman commented on Dec 11, 2022

    @ethanfurman
    MemberAuthor

    Okay, __text_signature__ is not settable on a class (so, for example, not on enum.Enum). It would take some changes in the C code and possibly to internal data structures to make that work.

    So instead I have a patch that augments inspect to be able to properly interpret __signature__ when it is a classmethod that returns a string.

  4. added a commit that references this issue on Dec 16, 2022
  5. added a commit that references this issue on Dec 16, 2022
  6. added a commit that references this issue on Jul 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

3.12only security fixesstdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions