mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
* Try to fix asyncio.Server.wait_closed() again I identified the condition that `wait_closed()` is intended to wait for: the server is closed *and* there are no more active connections. When this condition first becomes true, `_wakeup()` is called (either from `close()` or from `_detach()`) and it sets `_waiters` to `None`. So we just check for `self._waiters is None`; if it's not `None`, we know we have to wait, and do so. A problem was that the new test introduced in 3.12 explicitly tested that `wait_closed()` returns immediately when the server is *not* closed but there are currently no active connections. This was a mistake (probably a misunderstanding of the intended semantics). I've fixed the test, and added a separate test that checks exactly for this scenario. I also fixed an oddity where in `_wakeup()` the result of the waiter was set to the waiter itself. This result is not used anywhere and I changed this to `None`, to avoid a GC cycle. * Update Lib/asyncio/base_events.py --------- Co-authored-by: Carol Willing <carolcode@willingconsulting.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| __main__.py | ||
| echo.py | ||
| echo2.py | ||
| echo3.py | ||
| functional.py | ||
| test_base_events.py | ||
| test_buffered_proto.py | ||
| test_context.py | ||
| test_eager_task_factory.py | ||
| test_events.py | ||
| test_futures.py | ||
| test_futures2.py | ||
| test_locks.py | ||
| test_pep492.py | ||
| test_proactor_events.py | ||
| test_protocols.py | ||
| test_queues.py | ||
| test_runners.py | ||
| test_selector_events.py | ||
| test_sendfile.py | ||
| test_server.py | ||
| test_sock_lowlevel.py | ||
| test_ssl.py | ||
| test_sslproto.py | ||
| test_streams.py | ||
| test_subprocess.py | ||
| test_taskgroups.py | ||
| test_tasks.py | ||
| test_threads.py | ||
| test_timeouts.py | ||
| test_transports.py | ||
| test_unix_events.py | ||
| test_waitfor.py | ||
| test_windows_events.py | ||
| test_windows_utils.py | ||
| utils.py | ||