From 9512528a779983967c76c67739aa6127db6a46f1 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Fri, 31 Aug 2018 20:09:29 +0200 Subject: [PATCH] Fixed async funcs --- graphene/utils/thenables.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/graphene/utils/thenables.py b/graphene/utils/thenables.py index d18d7e61..a3089595 100644 --- a/graphene/utils/thenables.py +++ b/graphene/utils/thenables.py @@ -6,10 +6,13 @@ This includes: """ try: - from promise import Promise, is_thenable + from promise import Promise, is_thenable # type: ignore except ImportError: - def is_thenable(obj): + class Promise(object): # type: ignore + pass + + def is_thenable(obj): # type: ignore return False @@ -28,7 +31,7 @@ def maybe_thenable(obj, on_resolve): returning the same type of object inputed. If the object is not thenable, it should return on_resolve(obj) """ - if isawaitable(obj): + if isawaitable(obj) and not isinstance(obj, Promise): return await_and_execute(obj, on_resolve) if is_thenable(obj):