Skip to content

Derive EnumMeta from ABCMeta #1598

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

Merged
merged 2 commits into from
Sep 11, 2017
Merged

Derive EnumMeta from ABCMeta #1598

merged 2 commits into from
Sep 11, 2017

Conversation

elazarg
Copy link
Contributor

@elazarg elazarg commented Sep 10, 2017

Ad-hoc fix python/mypy#2824, avoiding #1595.

Quoting the comment:

This is a temporary workaround to allow multiple creation of enums with builtins such as str as mixins, which due to the handling of ABCs of builtin types, cause spurious inconsistent metaclass structure.

This workaround is relatively harmless since enums are never subclassed further. It "adds" an incorrect register method to enums and Enum, and may cause incorrect isinstance checks, but I think it will be much less common and therefore less serious than the current problems.

Avoid inconsistent metaclass structure for enum mixins due to python#1595 - e.g. mypy/python#2824
@JelleZijlstra JelleZijlstra merged commit d4b21ef into python:master Sep 11, 2017
@JelleZijlstra
Copy link
Member

Thanks for diagnosing the issue and providing a workaround!

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.

Metaclass is not properly inherited when using multiple inheritance with int
2 participants