From c4b8289fe4f4a3192fd1d501e74df08fd93ed348 Mon Sep 17 00:00:00 2001 From: Ewald de Wit Date: Mon, 15 Jan 2024 14:58:04 +0100 Subject: [PATCH] Fix patching an already running Proactor loop, fixes #87 --- nest_asyncio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nest_asyncio.py b/nest_asyncio.py index 4459699..01ec2ab 100644 --- a/nest_asyncio.py +++ b/nest_asyncio.py @@ -188,7 +188,7 @@ def _check_running(self): cls._run_once = _run_once cls._check_running = _check_running cls._check_runnung = _check_running # typo in Python 3.7 source - cls._num_runs_pending = 0 + cls._num_runs_pending = 1 if loop.is_running() else 0 cls._is_proactorloop = ( os.name == 'nt' and issubclass(cls, asyncio.ProactorEventLoop)) if sys.version_info < (3, 7, 0):