]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Make 652755e7571c8cc2ec4e8beab8ef6b1f180c496b compatible with py36
authorFederico Caselli <cfederico87@gmail.com>
Thu, 15 Sep 2022 21:38:47 +0000 (23:38 +0200)
committerFederico Caselli <cfederico87@gmail.com>
Thu, 15 Sep 2022 21:38:47 +0000 (23:38 +0200)
Change-Id: I8072146e9c4405a96b566392afa8e57661aa2a42

lib/sqlalchemy/ext/asyncio/engine.py
lib/sqlalchemy/ext/asyncio/session.py

index 5bfda1507049143d0242e60bfa049aa6a4d3b9fb..ba4dd39b6f29f9a49561b46caea900728fd4f3bb 100644 (file)
@@ -551,7 +551,7 @@ class AsyncConnection(ProxyComparable, StartableContext, AsyncConnectable):
         return self.start().__await__()
 
     async def __aexit__(self, type_, value, traceback):
-        task = asyncio.create_task(self.close())
+        task = asyncio.get_running_loop().create_task(self.close())
         await asyncio.shield(task)
 
 
@@ -607,7 +607,7 @@ class AsyncEngine(ProxyComparable, AsyncConnectable):
                 await self.transaction.__aexit__(type_, value, traceback)
                 await self.conn.close()
 
-            task = asyncio.create_task(go())
+            task = asyncio.get_running_loop().create_task(go())
             await asyncio.shield(task)
 
     def __init__(self, sync_engine):
index 7346840579cacd5bb0d16b1e50ce97d46ccb2927..61874378dd09c67edbd50897ebf5f1192eb70a94 100644 (file)
@@ -627,7 +627,7 @@ class AsyncSession(ReversibleProxy):
         return self
 
     async def __aexit__(self, type_, value, traceback):
-        task = asyncio.create_task(self.close())
+        task = asyncio.get_running_loop().create_task(self.close())
         await asyncio.shield(task)
 
     def _maker_context_manager(self):
@@ -649,7 +649,7 @@ class _AsyncSessionContextManager:
             await self.trans.__aexit__(type_, value, traceback)
             await self.async_session.__aexit__(type_, value, traceback)
 
-        task = asyncio.create_task(go())
+        task = asyncio.get_running_loop().create_task(go())
         await asyncio.shield(task)