Skip to content
Merged
Changes from all commits
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
12 changes: 8 additions & 4 deletions zigpy_znp/types/basic.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import sys
import enum
import typing

Expand Down Expand Up @@ -65,10 +66,13 @@ def __init_subclass__(cls, signed=None, size=None, hex_repr=None) -> None:
cls.__str__ = super().__str__
cls.__repr__ = super().__repr__

# 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.
if "__new__" not in cls.__dict__:
cls.__new__ = cls.__new__
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.
# Fixed with https://github.com/python/cpython/pull/26658
if "__new__" not in cls.__dict__:
cls.__new__ = cls.__new__

def serialize(self) -> bytes:
try:
Expand Down