homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jack__d
Recipients Genarito, davin, jack__d, pitrou, sicard_elda
Date 2021年07月24日.14:30:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1627137025.82.0.551904349877.issue43944@roundup.psfhosted.org>
In-reply-to
Content
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)
```
History
Date User Action Args
2021年07月24日 14:30:25jack__dsetrecipients: + jack__d, pitrou, davin, Genarito, sicard_elda
2021年07月24日 14:30:25jack__dsetmessageid: <1627137025.82.0.551904349877.issue43944@roundup.psfhosted.org>
2021年07月24日 14:30:25jack__dlinkissue43944 messages
2021年07月24日 14:30:25jack__dcreate

AltStyle によって変換されたページ (->オリジナル) /