Issue #24867: Fix asyncio.Task.get_stack() for 'async def' coroutines
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py
index 9bfc1cf..a235e74 100644
--- a/Lib/asyncio/tasks.py
+++ b/Lib/asyncio/tasks.py
@@ -128,7 +128,11 @@
         returned for a suspended coroutine.
         """
         frames = []
-        f = self._coro.gi_frame
+        try:
+            # 'async def' coroutines
+            f = self._coro.cr_frame
+        except AttributeError:
+            f = self._coro.gi_frame
         if f is not None:
             while f is not None:
                 if limit is not None: