mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 20:28:38 +00:00
[commands] Disallow float/complex in Literal but allow None
Type checkers (both mypy and pydantic) apparently don't like it
This commit is contained in:
parent
b84717fc76
commit
69da87f455
@ -136,7 +136,7 @@ def _evaluate_annotation(
|
|||||||
_evaluate_annotation(arg, globals, locals, cache, implicit_str=implicit_str) for arg in args
|
_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.')
|
raise TypeError('Literal arguments must be of type str, int, bool, float or complex.')
|
||||||
|
|
||||||
if evaluated_args == args:
|
if evaluated_args == args:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user