Ron Serruya <[email protected]> added the comment:
Sending Context.run to another process via ProccessPoolExecutor hangs forever:
```
from contextvars import ContextVar, copy_context
from concurrent.futures import ProcessPoolExecutor
from multiprocessing import Process
var: ContextVar[int] = ContextVar('var',default=None)
if __name__ == '__main__':
# ***** This hangs forever *****
with ProcessPoolExecutor(max_workers=1) as pp:
ctx = copy_context()
pp.submit(ctx.run, list)
# ****** This throws 'cannot pickle Context' *****
ctx = copy_context()
p = Process(target=ctx.run, args=(list,))
p.start()
p.join()
```
python version is 3.8.0
running on Mac OSX 10.15.1
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39257>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com