Issue 24017: Use abc.Coroutine in inspect.iscoroutine() function
diff --git a/Lib/inspect.py b/Lib/inspect.py
index d17a498..19b57b4 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -212,8 +212,7 @@
 
 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.