Skip to content

Commit

Permalink
Fix protocol enum construction on Python 3.13+
Browse files Browse the repository at this point in the history
On Python 3.13+, any protocol enum instance constructed from an int
value would be treated like an unrecognized value.
  • Loading branch information
Cirras committed Jan 9, 2025
1 parent 07298c8 commit 3adc065
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/eolib/protocol/protocol_enum_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ def __call__(cls, value, names=None, *, module=None, qualname=None, type=None, s
value, names=names, module=module, qualname=qualname, type=type, start=start
)
try:
return super().__call__(
value, names=names, module=module, qualname=qualname, type=type, start=start
)
return super().__call__(value, module=module, qualname=qualname, type=type, start=start)
except ValueError:
unrecognized = int.__new__(cls, value)
unrecognized._name_ = f"Unrecognized({int(value)})"
Expand Down

0 comments on commit 3adc065

Please sign in to comment.