Skip to content

asyncio.Server.socket fixes#5538

Merged
srittau merged 1 commit intopython:masterfrom
srittau:asyncio-sockets
May 27, 2021
Merged

asyncio.Server.socket fixes#5538
srittau merged 1 commit intopython:masterfrom
srittau:asyncio-sockets

Conversation

@srittau
Copy link
Copy Markdown
Collaborator

@srittau srittau commented May 27, 2021

  • Move socket from AbstractServer to Server.
  • Fix Server.socket type on Python 3.7+.
  • Use Iterable instead of list for socket argument.

Closes: #5535

* Move socket from AbstractServer to Server.
* Fix Server.socket type on Python 3.7+.
* Use Iterable instead of list for socket argument.

Closes: python#5535
@github-actions
Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

websockets (https://github.com/aaugustin/websockets.git)
+ src/websockets/legacy/server.py:847: error: "AbstractServer" has no attribute "sockets"
+ src/websockets/legacy/server.py:847: error: Returning Any from function declared to return "Optional[List[socket]]"

aiohttp (https://github.com/aio-libs/aiohttp.git)
+ aiohttp/web_runner.py:264: error: "AbstractServer" has no attribute "sockets"  [attr-defined]
+ aiohttp/test_utils.py:132: error: "AbstractServer" has no attribute "sockets"  [attr-defined]

@srittau
Copy link
Copy Markdown
Collaborator Author

srittau commented May 27, 2021

mypy test suite failure is unrelated. The primer warnings point to real potential problems. While this is likely usually not a problem at runtime, since AbstractServer == Server, it should be handled explicitly.

@srittau srittau merged commit ca256b8 into python:master May 27, 2021
@srittau srittau deleted the asyncio-sockets branch May 27, 2021 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong type hint for asyncio.base_events.Server sockets attribute

2 participants