Skip to content

Commit 9788eb4

Browse files
authored
fix: adjust DistinctFlag.__call__ for python 3.12.3+ (#1659)
As None is a valid value now, as of 3.12.3 it cannot be used for the name python/cpython#116040
1 parent b96eece commit 9788eb4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

interactions/models/discord/enums.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,10 @@ def __iter__(cls) -> Iterator:
103103

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

0 commit comments

Comments
 (0)