So we're deprecating passing non-ThreadPoolExecutor instances to loop.set_default_executor. In 3.9 that will trigger an error.
For this issue we have basically the next few options:
(1) Do nothing;
(2) Fix "run_in_executor" to start copying and running in correct context automatically
(3) Add a new keyword-only parameter to "run_in_executor": "retain_context=False"
(4) Design a new async/await friendly API for using thread- and process-pools.
Now, (4) will happen. The "run_in_executor" method is low-level and requires accessing the event loop to use it. We probably have enough time to design this new API before 3.8.
As for implementing (3) in 3.8 -- I'd be OK with that too. Andrew, your thoughts? |