From bb03995289322956ce936af6f154d90ddad58ac0 Mon Sep 17 00:00:00 2001 From: shiftinv Date: Mon, 9 Oct 2023 18:28:15 +0200 Subject: [PATCH] chore: clarify `__call__` comment --- disnake/ext/commands/params.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/disnake/ext/commands/params.py b/disnake/ext/commands/params.py index cddbda01c0..37f76a8d6c 100644 --- a/disnake/ext/commands/params.py +++ b/disnake/ext/commands/params.py @@ -759,7 +759,9 @@ def parse_converter_annotation(self, converter: Callable, fallback_annotation: A if isinstance(converter, (types.FunctionType, types.MethodType)): converter_func = converter else: - # if converter isn't a function/method, it should be a callable object/type + # if converter isn't a function/method, assume it's a callable object/type + # (we need `__call__` here to get the correct global namespace later, since + # classes do not have `__globals__`) converter_func = converter.__call__ _, parameters = isolate_self(get_signature_parameters(converter_func))