The Wayback Machine - https://web.archive.org/web/20251017020401/https://github.com/python/cpython/pull/30357
Skip to content

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Jan 3, 2022

Three major changes:

  1. Better error message, which is more informative and is in sync with

    cpython/Lib/enum.py

    Lines 850 to 853 in 549e628

    raise TypeError(
    "%s: cannot extend enumeration %r"
    % (class_name, base.__name__)
    )
    Another idea is too call _check_for_existing_members on first_enum in _get_mixins_. But, since _get_mixins_ is @staticmethod, I've decided not to use explicit EnumType._check_for_existing_members() or not to convert it to @classmethod
  2. For some reason in _create_ wrong type was passed to _get_mixins_, instead of str, Enum was passed
  3. I've also covered this feature with a test case

https://bugs.python.org/issue46242

@sobolevn
Copy link
Member Author

sobolevn commented Jan 3, 2022

Another idea is too call _check_for_existing_members on first_enum in get_mixins. But, since get_mixins is @staticmethod, I've decided not to use explicit EnumType._check_for_existing_members() or not to convert it to @classmethod

Here's a commit with this version: 9e7d02c Just to compare. Maybe I even like it more 🤔

@sobolevn
Copy link
Member Author

sobolevn commented Jan 8, 2022

Friendly CC @ethanfurman
Maybe you have missed this one? 🙂

@ethanfurman
Copy link
Member

Thanks, good fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

HTTPS · web.archive.org
← Home