Skip to content

Commit 69c94af

Browse files
DavidBordaaugustin
authored andcommitted
Future-proof asyncio.wait usage.
Fix #762.
1 parent fafcf65 commit 69c94af

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

.circleci/config.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ jobs:
3838
- checkout
3939
- run: sudo pip install tox
4040
- run: tox -e py38
41+
py39:
42+
docker:
43+
- image: circleci/python:3.9.0b1
44+
steps:
45+
# Remove IPv6 entry for localhost in Circle CI containers because it doesn't work anyway.
46+
- run: sudo cp /etc/hosts /tmp; sudo sed -i '/::1/d' /tmp/hosts; sudo cp /tmp/hosts /etc
47+
- checkout
48+
- run: sudo pip install tox
49+
- run: tox -e py39
4150

4251
workflows:
4352
version: 2
@@ -53,3 +62,6 @@ workflows:
5362
- py38:
5463
requires:
5564
- main
65+
- py39:
66+
requires:
67+
- main

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*.pyc
22
*.so
33
.coverage
4+
.idea/
45
.mypy_cache
56
.tox
67
build/

src/websockets/server.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,10 @@ async def _close(self) -> None:
714714
# asyncio.wait doesn't accept an empty first argument
715715
if self.websockets:
716716
await asyncio.wait(
717-
[websocket.close(1001) for websocket in self.websockets],
717+
[
718+
asyncio.ensure_future(websocket.close(1001))
719+
for websocket in self.websockets
720+
],
718721
loop=self.loop if sys.version_info[:2] < (3, 8) else None,
719722
)
720723

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py36,py37,py38,coverage,black,flake8,isort,mypy
2+
envlist = py36,py37,py38,py39,coverage,black,flake8,isort,mypy
33

44
[testenv]
55
commands = python -W default -m unittest {posargs}

0 commit comments

Comments
 (0)