aboutsummaryrefslogtreecommitdiff
path: root/discord/ext
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-04-27 05:39:50 -0400
committerRapptz <[email protected]>2021-04-27 05:48:27 -0400
commit69da87f455ccad8fed6c8349af95c54f4bb02b85 (patch)
tree3c8e2b6aa5d4032051b3da359e3ae050d3f572de /discord/ext
parentMake spelling of "colour" consistent in docs (diff)
downloaddiscord.py-69da87f455ccad8fed6c8349af95c54f4bb02b85.tar.xz
discord.py-69da87f455ccad8fed6c8349af95c54f4bb02b85.zip
[commands] Disallow float/complex in Literal but allow None
Type checkers (both mypy and pydantic) apparently don't like it
Diffstat (limited to 'discord/ext')
-rw-r--r--discord/ext/commands/core.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py
index 3c46c1b0..fcf58add 100644
--- a/discord/ext/commands/core.py
+++ b/discord/ext/commands/core.py
@@ -136,7 +136,7 @@ def _evaluate_annotation(
_evaluate_annotation(arg, globals, locals, cache, implicit_str=implicit_str) for arg in args
)
- if is_literal and not all(isinstance(x, (str, int, bool, float, complex)) for x in evaluated_args):
+ if is_literal and not all(isinstance(x, (str, int, bool, type(None))) for x in evaluated_args):
raise TypeError('Literal arguments must be of type str, int, bool, float or complex.')
if evaluated_args == args: