From ff54223606d899c57912dc9f1c5d0d0f331f96b8 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Thu, 21 May 2015 12:03:21 -0400 Subject: [PATCH] Issue 24017: Use abc.Coroutine in inspect.iscoroutine() function --- Lib/inspect.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/inspect.py b/Lib/inspect.py index d17a498a37e..19b57b4b15f 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -212,8 +212,7 @@ def isgenerator(object): def iscoroutine(object): """Return true if the object is a coroutine.""" - return (isinstance(object, types.GeneratorType) and - object.gi_code.co_flags & (CO_COROUTINE | CO_ITERABLE_COROUTINE)) + return isinstance(object, collections.abc.Coroutine) def istraceback(object): """Return true if the object is a traceback.