aboutsummaryrefslogtreecommitdiff
path: root/discord
diff options
context:
space:
mode:
Diffstat (limited to 'discord')
-rw-r--r--discord/ext/commands/core.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py
index 7c802873..3c46c1b0 100644
--- a/discord/ext/commands/core.py
+++ b/discord/ext/commands/core.py
@@ -112,6 +112,7 @@ def _evaluate_annotation(
if hasattr(tp, '__args__'):
implicit_str = True
+ is_literal = False
args = tp.__args__
if not hasattr(tp, '__origin__'):
if PY_310 and tp.__class__ is types.Union:
@@ -129,12 +130,13 @@ def _evaluate_annotation(
if not PY_310:
args = flatten_literal_params(tp.__args__)
implicit_str = False
+ is_literal = True
evaluated_args = tuple(
_evaluate_annotation(arg, globals, locals, cache, implicit_str=implicit_str) for arg in args
)
- if 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, float, complex)) for x in evaluated_args):
raise TypeError('Literal arguments must be of type str, int, bool, float or complex.')
if evaluated_args == args: