diff --git a/src/trio/_core/_run.py b/src/trio/_core/_run.py index 1e37a7dbb2..c90989e560 100644 --- a/src/trio/_core/_run.py +++ b/src/trio/_core/_run.py @@ -1758,7 +1758,7 @@ def spawn_impl( except AttributeError: name = repr(name) - if not hasattr(coro, "cr_frame"): + if getattr(coro, "cr_frame", None) is None: # This async function is implemented in C or Cython async def python_wrapper(orig_coro: Awaitable[RetT]) -> RetT: return await orig_coro