Message221128
When you use `concurrent.futures.ProcessPoolExecutor` and an exception is raised in the created process, it doesn't show you the traceback. This makes debugging very annoying.
Example file:
#!python
import sys
import concurrent.futures
def f():
# Successful assert:
assert True
return g()
def g():
# Hard-to-find failing assert:
assert False
if __name__ == '__main__':
with concurrent.futures.ProcessPoolExecutor(max_workers=1) as executor:
assert isinstance(executor, concurrent.futures.Executor)
future = executor.submit(f)
future.result()
print('Main process finished')
If you run this under Windows, you get this:
Traceback (most recent call last):
File "./bug.py", line 20, in <module>
future.result()
File "c:\python34\lib\concurrent\futures\_base.py", line 402, in result
return self.__get_result()
File "c:\python34\lib\concurrent\futures\_base.py", line 354, in __get_result
raise self._exception
AssertionError
This is the traceback of the main process, while we want the traceback of the process that failed. |
|
Date |
User |
Action |
Args |
2014-06-20 22:13:22 | cool-RR | set | recipients:
+ cool-RR |
2014-06-20 22:13:22 | cool-RR | set | messageid: <1403302402.66.0.944637105053.issue21817@psf.upfronthosting.co.za> |
2014-06-20 22:13:22 | cool-RR | link | issue21817 messages |
2014-06-20 22:13:22 | cool-RR | create | |
|