File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 55# the Apache 2.0 License: http://www.apache.org/licenses/LICENSE-2.0
66
77
8+ import asyncio
89import functools
910import os
1011import pathlib
1314
1415
1516PY_36 = sys .version_info >= (3 , 6 )
17+ PY_37 = sys .version_info >= (3 , 7 )
1618SYSTEM = platform .uname ().system
1719
1820
@@ -69,3 +71,11 @@ def get_pg_home_directory() -> pathlib.Path:
6971else :
7072 def get_pg_home_directory () -> pathlib .Path :
7173 return pathlib .Path .home ()
74+
75+
76+ if PY_37 :
77+ def current_asyncio_task (loop ):
78+ return asyncio .current_task (loop )
79+ else :
80+ def current_asyncio_task (loop ):
81+ return asyncio .Task .current_task (loop )
Original file line number Diff line number Diff line change @@ -1159,7 +1159,7 @@ async def _cancel(self, waiter):
11591159 waiter .set_exception (ex )
11601160 finally :
11611161 self ._cancellations .discard (
1162- asyncio . Task . current_task (self ._loop ))
1162+ compat . current_asyncio_task (self ._loop ))
11631163 if not waiter .done ():
11641164 waiter .set_result (None )
11651165 if w is not None :
You can’t perform that action at this time.
0 commit comments