From: Mike Bayer Date: Thu, 28 Dec 2023 15:01:02 +0000 (-0500) Subject: correct for asyncio.Runner not in py311 stubs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63add624878c9a7a27d6d230cbcf3ccf3786ada1;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git correct for asyncio.Runner not in py311 stubs Second attempt. TYPE_CHECKING has to be unconditional because mypy doesnt know anything about py311 / py312 booleans Change-Id: I28c6dff98f9d2021ad827ba2190fbcfd31ffa9d0 --- diff --git a/lib/sqlalchemy/util/concurrency.py b/lib/sqlalchemy/util/concurrency.py index bcdb928c29..1d6e371c21 100644 --- a/lib/sqlalchemy/util/concurrency.py +++ b/lib/sqlalchemy/util/concurrency.py @@ -239,11 +239,11 @@ class AsyncAdaptedLock: self.mutex.release() -if py311: +if not TYPE_CHECKING and py311: _Runner = asyncio.Runner else: - class _Runner: # type: ignore[no-redef] + class _Runner: """Runner implementation for test only""" _loop: Union[None, asyncio.AbstractEventLoop, Literal[False]]