]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
correct for asyncio.Runner not in py311 stubs
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 28 Dec 2023 15:01:02 +0000 (10:01 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 28 Dec 2023 15:01:02 +0000 (10:01 -0500)
Second attempt.  TYPE_CHECKING has to be unconditional because
mypy doesnt know anything about py311 / py312 booleans

Change-Id: I28c6dff98f9d2021ad827ba2190fbcfd31ffa9d0

lib/sqlalchemy/util/concurrency.py

index bcdb928c29619ae14036a54b2f8564a856fb32fa..1d6e371c21d3f5aa5da7cb9a7a0d7ed80bafa108 100644 (file)
@@ -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]]