File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change
1
+ import asyncio
2
+
3
+ try : # pragma: no cover
4
+ asyncio_create_task = asyncio .create_task # Python ≥ 3.7
5
+ except AttributeError : # pragma: no cover
6
+ asyncio_create_task = asyncio .ensure_future # Python < 3.7
Original file line number Diff line number Diff line change 28
28
cast ,
29
29
)
30
30
31
+ from .compatibility import asyncio_create_task
31
32
from .exceptions import (
32
33
AbortHandshake ,
33
34
InvalidHandshake ,
@@ -715,9 +716,7 @@ async def _close(self) -> None:
715
716
if self .websockets :
716
717
await asyncio .wait (
717
718
[
718
- asyncio .ensure_future (websocket .close (1001 ))
719
- if sys .version_info [:2 ] < (3 , 7 )
720
- else asyncio .create_task (websocket .close (1001 ))
719
+ asyncio_create_task (websocket .close (1001 ))
721
720
for websocket in self .websockets
722
721
],
723
722
loop = self .loop if sys .version_info [:2 ] < (3 , 8 ) else None ,
You can’t perform that action at this time.
0 commit comments