Skip to content
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

Don't reassign cls.__new__ for Python 3.10+ #219

Merged
merged 2 commits into from
Jul 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix lint
cdce8p committed Jul 20, 2023
commit 1f160f3614b8400d98c769a2206f1c82abc7a63c
7 changes: 4 additions & 3 deletions zigpy_znp/types/basic.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import enum
import sys
import enum
import typing

import zigpy.types as zigpy_t
@@ -67,8 +67,9 @@ def __init_subclass__(cls, signed=None, size=None, hex_repr=None) -> None:
cls.__repr__ = super().__repr__

if sys.version_info < (3, 10):
# XXX: The enum module uses the first class with __new__ in its __dict__ as the
# member type. We have to ensure this is true for every subclass.
# XXX: The enum module uses the first class with __new__ in its __dict__
# as the member type. We have to ensure this is true for
# every subclass.
# Fixed with https://github.com/python/cpython/pull/26658
if "__new__" not in cls.__dict__:
cls.__new__ = cls.__new__