From dbf7e4d35e340678aa83448c5d9aa2ac83fa6861 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 17 May 2020 03:28:04 +0100 Subject: [PATCH] Check if converter is a class before trying to instantiate it --- houdini/converters.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/houdini/converters.py b/houdini/converters.py index e780401..d57d946 100644 --- a/houdini/converters.py +++ b/houdini/converters.py @@ -472,10 +472,11 @@ def get_converter(component): async def do_conversion(converter, ctx): - if not isinstance(converter, IConverter) and issubclass(converter, IConverter): - converter = converter() - if isinstance(converter, IConverter): - if asyncio.iscoroutinefunction(converter.convert): - return await converter.convert(ctx) - return converter.convert(ctx) + if inspect.isclass(converter): + if not isinstance(converter, IConverter) and issubclass(converter, IConverter): + converter = converter() + if isinstance(converter, IConverter): + if asyncio.iscoroutinefunction(converter.convert): + return await converter.convert(ctx) + return converter.convert(ctx) return converter(ctx.argument)