Skip to content

Future-proof asyncio.wait usage. #766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ jobs:
- checkout
- run: sudo pip install tox
- run: tox -e py38
py39:
docker:
- image: circleci/python:3.9.0b1
steps:
# Remove IPv6 entry for localhost in Circle CI containers because it doesn't work anyway.
- run: sudo cp /etc/hosts /tmp; sudo sed -i '/::1/d' /tmp/hosts; sudo cp /tmp/hosts /etc
- checkout
- run: sudo pip install tox
- run: tox -e py39

workflows:
version: 2
Expand All @@ -53,3 +62,6 @@ workflows:
- py38:
requires:
- main
- py39:
requires:
- main
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.pyc
*.so
.coverage
.idea/
.mypy_cache
.tox
build/
Expand Down
5 changes: 4 additions & 1 deletion src/websockets/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,10 @@ async def _close(self) -> None:
# asyncio.wait doesn't accept an empty first argument
if self.websockets:
await asyncio.wait(
[websocket.close(1001) for websocket in self.websockets],
[
asyncio.ensure_future(websocket.close(1001))
for websocket in self.websockets
],
loop=self.loop if sys.version_info[:2] < (3, 8) else None,
)

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py36,py37,py38,coverage,black,flake8,isort,mypy
envlist = py36,py37,py38,py39,coverage,black,flake8,isort,mypy

[testenv]
commands = python -W default -m unittest {posargs}
Expand Down