Sitelet https://github.com/python/cpython/issues/88123#top
Skip to content

[Enum] update __contains__ to return True for valid values #88123

Description

@ethanfurman
BPO 43957
Nosy @ethanfurman, @pablogsal
PRs
  • bpo-43957: [Enum] deprecate TypeError from containment checks #25670
  • bpo-43957: Add a missing space to the new format enum warning #25770
  • 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 2021-05-01.20:39:22.594>
    created_at = <Date 2021-04-27.19:11:08.744>
    labels = ['type-bug', '3.10']
    title = '[Enum] update __contains__ to return True for valid values'
    updated_at = <Date 2021-05-01.20:39:22.594>
    user = 'https://github.com/ethanfurman'

    bugs.python.org fields:

    activity = <Date 2021-05-01.20:39:22.594>
    actor = 'ethan.furman'
    assignee = 'ethan.furman'
    closed = True
    closed_date = <Date 2021-05-01.20:39:22.594>
    closer = 'ethan.furman'
    components = []
    creation = <Date 2021-04-27.19:11:08.744>
    creator = 'ethan.furman'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43957
    keywords = ['patch']
    message_count = 4.0
    messages = ['392122', '392127', '392622', '392633']
    nosy_count = 2.0
    nosy_names = ['ethan.furman', 'pablogsal']
    pr_nums = ['25670', '25770']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue43957'
    versions = ['Python 3.10']

    Activity

    1. ethanfurman commented on Apr 27, 2021

      @ethanfurman
      MemberAuthor

      In 3.12 __contains__ will check for both members and values:

      Color.RED in Color  --> True
      1 in Color          --> True
      'RED' in Color      --> False
      

      Add DeprecationWarning for now.

    2. self-assigned this
      on Apr 27, 2021
    3. self-assigned this
      on Apr 27, 2021
    4. ethanfurman commented on Apr 27, 2021

      @ethanfurman
      MemberAuthor

      New changeset 6bd9288 by Ethan Furman in branch 'master':
      bpo-43957: [Enum] Deprecate TypeError from containment checks. (GH-25670)
      6bd9288

    5. pablogsal commented on May 1, 2021

      @pablogsal
      Member

      New changeset 9a42d50 by Pablo Galindo in branch 'master':
      bpo-43957: Add a missins space to the new format enum warning (bpo-25770)
      9a42d50

    6. pablogsal commented on May 1, 2021

      @pablogsal
      Member

      Ethan can we close this issue?

    7. transferred this issue fromon Apr 10, 2022
    8. corona10 commented on May 17, 2022

      @corona10
      Member

      @ethanfurman __contains__ should be updated before Python 3.12 is released.
      I add this issue as a release blocker since tests are broken.
      cc @pablogsal

    9. 1 remaining item

    10. added
      3.12only security fixes
      and removed on May 17, 2022
    11. carlbordum commented on May 27, 2022

      @carlbordum
      Contributor

      I have attempted to implement the new behaviour here #93298

    12. added 2 commits that reference this issue on Jun 22, 2022
    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 fixesrelease-blockertype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions