Christian Heimes <[email protected]> added the comment:
The default policy of asyncio deliberately limits automatic creation of event loops to the main thread. You can't just mix asyncio with a threaded web application and expect it to work correctly. See https://github.com/python/cpython/blob/a487a39dca4c41305928c7dfdbcb0b3aa344683b/Lib/asyncio/events.py#L609-L620 In this policy, each thread has its own event loop. However, we only automatically create an event loop by default for the main thread; other threads by default have no event loop. Other policies may have different rules (e.g. a single global event loop, or automatically creating an event loop per thread, or using some other notion of context to which an event loop is associated). ---------- nosy: +christian.heimes _______________________________________ Python tracker <[email protected]> <https://bugs.python.org/issue40811> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
