Jack DeVries <[email protected]> added the comment:
Ah never mind. @Genarito, the ThreadPoolExecutor is supposed to be used as a
context manager. In your current code, the script ends and Python starts
tearing itself down while `execute_error` is still running in a subprocess.
If you simply use the ThreadPoolExecutor to a context manager, the error goes
away::
```python
from multiprocessing import Process
from concurrent.futures import ThreadPoolExecutor
def some_task():
pass
def execute_error():
p = Process(target=some_task)
p.start()
p.join()
print(p.exitcode) # This is always 1 on a ThreadPoolExecutor!!!
# THIS IS THE IMPORTANT CHANGE
with ThreadPoolExecutor(max_workers=4) as executor:
executor.submit(execute_error)
```
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue43944>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com