Skip to content

Commit

Permalink
fix: adjust DistinctFlag.__call__ for python 3.12.3+ (#1659)
Browse files Browse the repository at this point in the history
As None is a valid value now, as of 3.12.3 it cannot be used
for the name python/cpython#116040
  • Loading branch information
Scrxtchy committed Apr 20, 2024
1 parent b96eece commit 9788eb4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion interactions/models/discord/enums.py
Expand Up @@ -103,9 +103,10 @@ def __iter__(cls) -> Iterator:

def __call__(cls, value, names=None, *, module=None, qualname=None, type=None, start=1) -> "DistinctFlag":
# To automatically convert string values into ints (eg for permissions)
kwargs = {"names": names} if names else {}
try:
int_value = int(value)
return super().__call__(int_value, names, module=module, qualname=qualname, type=type, start=start)
return super().__call__(int_value, module=module, qualname=qualname, type=type, start=start, **kwargs)
except (TypeError, ValueError):
return _return_cursed_enum(cls, value)

Expand Down

0 comments on commit 9788eb4

Please sign in to comment.