Issue31950
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2017-11-05 18:16 by pitrou, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 4306 | merged | pitrou, 2017-11-07 08:44 | |
| PR 4307 | merged | python-dev, 2017-11-07 09:26 | |
| Messages (5) | |||
|---|---|---|---|
| msg305607 - (view) | Author: Antoine Pitrou (pitrou) * ![]() |
Date: 2017-11-05 18:16 | |
The doc for the default event loop policy states that """the default policy defines context as the current thread, and manages an event loop per thread that interacts with asyncio""". What it doesn't mention, though, is that you get a RuntimeError if you call get_event_loop() in a non-main thread -- you first have to call set_event_loop(new_event_loop()) in that thread. This wasn't expected by me. As a side note, customizing the event loop policy isn't trivial either: it seems it's best to subclass DefaultEventLoopPolicy and make adjustments by overriding the API methods. Writing your own wouldn't work, as e.g. the Unix default policy has custom initialization code for child watchers. |
|||
| msg305711 - (view) | Author: Guido van Rossum (gvanrossum) * ![]() |
Date: 2017-11-07 05:35 | |
Agreed that this needs more clarification. Is something stopping you from submitting a PR? Note that the thing about non-main-threads is mentioned in the docstring for BaseDefaultEventLoopPolicy. I agree that the best way to create a new policy is to study the existing code and subclass DefaultEventLoopPolicy. |
|||
| msg305723 - (view) | Author: Antoine Pitrou (pitrou) * ![]() |
Date: 2017-11-07 09:26 | |
New changeset 4135c89395726024abddb7340a0c7a42c801f616 by Antoine Pitrou in branch 'master': bpo-31950: Improve event loop policy doc (#4306) https://github.com/python/cpython/commit/4135c89395726024abddb7340a0c7a42c801f616 |
|||
| msg305724 - (view) | Author: Antoine Pitrou (pitrou) * ![]() |
Date: 2017-11-07 09:34 | |
New changeset e65617f65e203a2a6d3e3100d0d6fed0ffa0613d by Antoine Pitrou (Miss Islington (bot)) in branch '3.6': bpo-31950: Improve event loop policy doc (GH-4306) (#4307) https://github.com/python/cpython/commit/e65617f65e203a2a6d3e3100d0d6fed0ffa0613d |
|||
| msg305725 - (view) | Author: Antoine Pitrou (pitrou) * ![]() |
Date: 2017-11-07 09:35 | |
Thank you Guido. This is fixed now. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:54 | admin | set | github: 76131 |
| 2017-11-07 09:35:23 | pitrou | set | status: open -> closed resolution: fixed messages: + msg305725 stage: patch review -> resolved |
| 2017-11-07 09:34:49 | pitrou | set | messages: + msg305724 |
| 2017-11-07 09:26:47 | python-dev | set | pull_requests: + pull_request4270 |
| 2017-11-07 09:26:39 | pitrou | set | messages: + msg305723 |
| 2017-11-07 08:44:51 | pitrou | set | keywords:
+ patch stage: patch review pull_requests: + pull_request4269 |
| 2017-11-07 05:36:04 | gvanrossum | set | messages: + msg305711 |
| 2017-11-05 18:16:09 | pitrou | create | |
