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

2019-02-22 Thread Kevin Mai-Hsuan Chia


Kevin Mai-Hsuan Chia  added the comment:

@mdk That's interesting. May I ask which one is the preferred behavior, `None` 
or `[]`? IMO both make sense, but `None` is more consistent with the behavior 
in previous versions. If it is the case, may I work on fixing this(`None` to 
`[]`) as a practice to contribute? Otherwise, the PR from @eamanu should be 
enough to fix the document. Thanks a lot for the review and the pointer!

--

___
Python tracker 
<https://bugs.python.org/issue36074>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35826] Typo in example for async with statement with condition

2019-02-22 Thread Kevin Mai-Hsuan Chia


Kevin Mai-Hsuan Chia  added the comment:

Cool! Thanks for the reminder.

--
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue35826>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2019-02-22 Thread Kevin Mai-Hsuan Chia


Kevin Mai-Hsuan Chia  added the comment:

Sure thing. Should it be discussed more detailed before the PR? If the document 
or the returned value is controversial, I would like to contribute if needed. 
Thanks :)

--

___
Python tracker 
<https://bugs.python.org/issue36074>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2019-02-22 Thread Kevin Mai-Hsuan Chia


Kevin Mai-Hsuan Chia  added the comment:

Excuse me, I tried 3.7.2 and 3.8.0a1+ with the following code and still failed. 
Could you help me to try this? or can you give me a pointer to the code 
returning `None`? Sorry for the inconvenience and thanks a lot.
```
import asyncio
import platform


async def close_server():
def handler(reader, writer):
pass
s = await asyncio.start_server(handler, host='127.0.0.1', port=34567)
s.close()
await s.wait_closed()
assert s.sockets is None


print("version: ", platform.python_version())
asyncio.get_event_loop().run_until_complete(close_server())
```

--

___
Python tracker 
<https://bugs.python.org/issue36074>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2019-02-22 Thread Kevin Mai-Hsuan Chia


New submission from Kevin Mai-Hsuan Chia :

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@python
components: Documentation
messages: 336287
nosy: docs@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 
<https://bugs.python.org/issue36074>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35826] Typo in example for async with statement with condition

2019-01-25 Thread Kevin Mai-Hsuan Chia


Change by Kevin Mai-Hsuan Chia :


--
keywords: +patch, patch, patch, patch
pull_requests: +11511, 11512, 11513, 11514
stage:  -> patch review

___
Python tracker 
<https://bugs.python.org/issue35826>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35826] Typo in example for async with statement with condition

2019-01-25 Thread Kevin Mai-Hsuan Chia


Change by Kevin Mai-Hsuan Chia :


--
keywords: +patch, patch, patch
pull_requests: +11511, 11512, 11514
stage:  -> patch review

___
Python tracker 
<https://bugs.python.org/issue35826>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35826] Typo in example for async with statement with condition

2019-01-25 Thread Kevin Mai-Hsuan Chia


Change by Kevin Mai-Hsuan Chia :


--
keywords: +patch
pull_requests: +11511
stage:  -> patch review

___
Python tracker 
<https://bugs.python.org/issue35826>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35826] Typo in example for async with statement with condition

2019-01-25 Thread Kevin Mai-Hsuan Chia


Change by Kevin Mai-Hsuan Chia :


--
keywords: +patch, patch
pull_requests: +11511, 11512
stage:  -> patch review

___
Python tracker 
<https://bugs.python.org/issue35826>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35826] Typo in example for async with statement with condition

2019-01-25 Thread Kevin Mai-Hsuan Chia


Kevin Mai-Hsuan Chia  added the comment:

In the 
[example](https://docs.python.org/3.8/library/asyncio-sync.html#asyncio.Condition)
 of the equivalent code to the `async with` statement:
```python
cond = asyncio.Condition()

# ... later
await lock.acquire()
try:
await cond.wait()
finally:
lock.release()
```

`lock.acquire()` should be replaced by `cond.acquire()`, and `lock.release()` 
replaced by `cond.release()`. So the resulting code snippet becomes:

```python
cond = asyncio.Condition()

# ... later
await cond.acquire()
try:
await cond.wait()
finally:
cond.release()
```

--

___
Python tracker 
<https://bugs.python.org/issue35826>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35826] Typo in example for async with statement with condition

2019-01-25 Thread Kevin Mai-Hsuan Chia


New submission from Kevin Mai-Hsuan Chia :

In the 
[example](https://docs.python.org/3.8/library/asyncio-sync.html#asyncio.Condition)
 of the equivalent code to the `async with statement`:
```python
cond = asyncio.Condition()

# ... later
await lock.acquire()
try:
await cond.wait()
finally:
lock.release()
```

`lock.acquire()` should be replaced by `cond.acquire()`, and `lock.release()` 
replaced by `cond.release()`. So the resulting code snippet becomes:

```python
cond = asyncio.Condition()

# ... later
await cond.acquire()
try:
await cond.wait()
finally:
cond.release()
```

--
assignee: docs@python
components: Documentation
messages: 334349
nosy: docs@python, mhchia
priority: normal
severity: normal
status: open
title: Typo in example for async with statement with condition
type: enhancement
versions: Python 3.8

___
Python tracker 
<https://bugs.python.org/issue35826>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com