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.

Author pitrou
Recipients docs@python, giampaolo.rodola, gvanrossum, pitrou, vstinner, yselivanov
Date 2017-11-05.18:16:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1509905769.74.0.213398074469.issue31950@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-11-05 18:16:09pitrousetrecipients: + pitrou, gvanrossum, vstinner, giampaolo.rodola, docs@python, yselivanov
2017-11-05 18:16:09pitrousetmessageid: <1509905769.74.0.213398074469.issue31950@psf.upfronthosting.co.za>
2017-11-05 18:16:09pitroulinkissue31950 messages
2017-11-05 18:16:09pitroucreate