From 8e3ab3aec8ef19f690ccc0edd9f6ef3f6defa636 Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Tue, 17 Jun 2025 17:58:10 -0400 Subject: [PATCH 1/2] feat(docs): detail issue with inspect.iscoroutinefunction Silly little PR, but I'm also opening an issue at the same time and will make an attempt to solve the problem in the next few weeks. --- mypyc/doc/differences_from_python.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/mypyc/doc/differences_from_python.rst b/mypyc/doc/differences_from_python.rst index 65ad709677af..fafa2a12d7a7 100644 --- a/mypyc/doc/differences_from_python.rst +++ b/mypyc/doc/differences_from_python.rst @@ -317,6 +317,7 @@ non-exhaustive list of what won't work: - Frames of compiled functions can't be inspected using ``inspect`` - Compiled methods aren't considered methods by ``inspect.ismethod`` - ``inspect.signature`` chokes on compiled functions +- ``inspect.iscoroutinefunction`` always returns False for compiled functions, even those defined with `async def` Profiling hooks and tracing *************************** From 5797b5762aab4299bc59a06363809ddf6a573eeb Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Tue, 17 Jun 2025 18:03:10 -0400 Subject: [PATCH 2/2] feat: add asyncio.iscoroutinefunction --- mypyc/doc/differences_from_python.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypyc/doc/differences_from_python.rst b/mypyc/doc/differences_from_python.rst index fafa2a12d7a7..5a230bd984c2 100644 --- a/mypyc/doc/differences_from_python.rst +++ b/mypyc/doc/differences_from_python.rst @@ -317,7 +317,7 @@ non-exhaustive list of what won't work: - Frames of compiled functions can't be inspected using ``inspect`` - Compiled methods aren't considered methods by ``inspect.ismethod`` - ``inspect.signature`` chokes on compiled functions -- ``inspect.iscoroutinefunction`` always returns False for compiled functions, even those defined with `async def` +- ``inspect.iscoroutinefunction`` and ``asyncio.iscoroutinefunction`` will always return False for compiled functions, even those defined with `async def` Profiling hooks and tracing ***************************