PrettyErrors icon indicating copy to clipboard operation
PrettyErrors copied to clipboard

stack trace when exception occurs in concurrent.futures.ThreadPoolExecutor

Open horatio-sans-serif opened this issue 3 years ago • 0 comments

The stack trace pretty errors outputs is that of the main thread. Say I have a task in a thread pool that raises an AssertionError. pretty errors just outputs "AssertionError".

runpy.py 196 _run_module_as_main
"/Users/me/.asdf/installs/python/3.10.0/lib/python3.10/runpy.py", line 196
return _run_code(code, main_globals, None,



ap_rescheduler.py 179 reschedule_aps
"xxx.py", line 179
new_schedule = future.result()


_base.py 438 result
"/Users/me/.asdf/installs/python/3.10.0/lib/python3.10/concurrent/futures/_base.py", line 438
return self.__get_result()



_base.py 390 __get_result
"/Users/me/.asdf/installs/python/3.10.0/lib/python3.10/concurrent/futures/_base.py", line 390
try:
    raise self._exception
finally:

self: None

AssertionError

Disabling pretty errors temporarily with PYTHON_PRETTY_ERRORS=0 shows a better trace in that it shows me where the assertion failed.

concurrent.futures.process._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/Users/me/.asdf/installs/python/3.10.0/lib/python3.10/concurrent/futures/process.py", line 243, in _process_worker
    r = call_item.fn(*call_item.args, **call_item.kwargs)
  File "foo.py", line 463, in bar
    assert False
AssertionError

Is there a setting or trick to enable this while using pretty errors? Thank you.

horatio-sans-serif avatar Feb 09 '22 15:02 horatio-sans-serif