diff --git a/tests/test_base.py b/tests/test_base.py index a8eb3b4d..759e205b 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -602,6 +602,16 @@ async def coro(): self.loop.set_task_factory(None) self.assertIsNone(self.loop.get_task_factory()) + def test_asyncgen_hooks(self): + async def acall(fn): + return fn() + + # for sniffio to detect uvloop as asyncio efficiently the running loop + # call_soon module needs to match the asyncgen_hooks module + hooks = self.loop.run_until_complete(acall(sys.get_asyncgen_hooks)) + self.assertEqual(hooks.finalizer.__module__, "uvloop.loop") + self.assertEqual(self.loop.call_soon.__module__, "uvloop.loop") + def test_shutdown_asyncgens_01(self): finalized = list() diff --git a/uvloop/loop.pxd b/uvloop/loop.pxd index 2080dfe9..4a7b006d 100644 --- a/uvloop/loop.pxd +++ b/uvloop/loop.pxd @@ -1,4 +1,4 @@ -# cython: language_level=3 +# cython: language_level=3, embedsignature=True, binding=True from .includes cimport uv diff --git a/uvloop/loop.pyx b/uvloop/loop.pyx index afaa94e3..9eb059a4 100644 --- a/uvloop/loop.pyx +++ b/uvloop/loop.pyx @@ -1,4 +1,4 @@ -# cython: language_level=3, embedsignature=True +# cython: language_level=3, embedsignature=True, binding=True import asyncio cimport cython