Skip to content

EnumMeta.__new__ should use enum_class.__new__ #78263

Description

@rs2
mannequin
BPO 34082
Nosy @warsaw, @ethanfurman, @rs2
Superseder
  • bpo-29577: Enum: mixin classes don't mix well with already mixed Enums
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ethanfurman'
    closed_at = <Date 2018-09-11.01:21:40.505>
    created_at = <Date 2018-07-10.09:43:46.589>
    labels = ['type-bug', 'library']
    title = 'EnumMeta.__new__ should use enum_class.__new__'
    updated_at = <Date 2018-09-11.01:21:40.504>
    user = 'https://github.com/rs2'

    bugs.python.org fields:

    activity = <Date 2018-09-11.01:21:40.504>
    actor = 'ethan.furman'
    assignee = 'ethan.furman'
    closed = True
    closed_date = <Date 2018-09-11.01:21:40.505>
    closer = 'ethan.furman'
    components = ['Library (Lib)']
    creation = <Date 2018-07-10.09:43:46.589>
    creator = 'rs2'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 34082
    keywords = []
    message_count = 2.0
    messages = ['321370', '324974']
    nosy_count = 4.0
    nosy_names = ['barry', 'eli.bendersky', 'ethan.furman', 'rs2']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '29577'
    type = 'behavior'
    url = 'https://bugs.python.org/issue34082'
    versions = ['Python 3.5', 'Python 3.6']

    Activity

    1. rs2 commented on Jul 10, 2018

      rs2mannequin
      MannequinAuthor
      class Foo:
          pass
      
      class Works(str, Foo, Enum):
          BAR = 'baz'
      
      class Fails(Foo, str, Enum):
          BAR = 'baz'

      Fails fails to be created with an error:

      TypeError: object.__new__(Fails) is not safe, use Fails.__new__()

      See

      enum_member = __new__(enum_class)

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or error
      on Jul 10, 2018
    3. self-assigned this
      on Jul 10, 2018
    4. ethanfurman commented on Sep 11, 2018

      @ethanfurman
      Member

      The solution to 29577 will also fix this.

    5. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions