[issue36074] Result of `asyncio.Server.sockets` after `Server.close()` is not clear

Kevin Mai-Hsuan Chia report at bugs.python.org
Fri Feb 22 04:14:20 EST 2019


New submission from Kevin Mai-Hsuan Chia <kevin at mhchia.com>:

It seems the result of `asyncio.Server.sockets` after `asyncio.Server.close()` is performed becomes `[]` instead of `None` since python 3.7. However, in the [document 3.7 and 3.8](https://docs.python.org/3.8/library/asyncio-eventloop.html#asyncio.Server.sockets), it states
```
List of socket.socket objects the server is listening on, or None if the server is closed.

Changed in version 3.7: Prior to Python 3.7 Server.sockets used to return an internal list of server sockets directly. In 3.7 a copy of that list is returned.
```
For me, I think the comment `Changed in version 3.7: ...` only emphasizes the "copied list" is returned. IMO it will be more clear if the change from `None` to `[]` is mentioned in the comment as well. Sorry if this issue is not appropriate. Thanks!

----------
assignee: docs at python
components: Documentation
messages: 336287
nosy: docs at python, mhchia
priority: normal
severity: normal
status: open
title: Result of `asyncio.Server.sockets` after `Server.close()` is not clear
type: enhancement
versions: Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36074>
_______________________________________


More information about the Python-bugs-list mailing list