[issue34014] loop.run_in_executor should propagate current contextvars

Viktor Kovtun report at bugs.python.org
Sat Jun 30 20:10:13 EDT 2018


Viktor Kovtun <hellysmile at gmail.com> added the comment:

What about to check instance of executor and depending on that propagate contextvars or not?

As well to raise RuntimeError for ProcessPoolExecutor with provided context?

I assume, that ProcessPoolExecutor as executor is not so popular in real world, but I can not provide any stats.

Different behavior is defiantly at least weird, but do not support natively what is technically expected also strange.

https://docs.python.org/3.7/library/contextvars.html#asyncio-support `Context variables are natively supported in asyncio` is hard for end users.

Each use case of contextvars + run_in_executor will produce copy-paste boilerplate

As for me it is very similar to the `asyncio.get_event_loop()` history

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34014>
_______________________________________


More information about the Python-bugs-list mailing list