Professional Documents
Culture Documents
Base Taskpys
Base Taskpys
import reprlib
import traceback
def _task_repr_info(task):
info = base_futures._future_repr_info(task)
coro = coroutines._format_coroutine(task._coro)
info.insert(2, f'coro=<{coro}>')
@reprlib.recursive_repr()
def _task_repr(task):
info = ' '.join(_task_repr_info(task))
return f'<{task.__class__.__name__} {info}>'
exc = task._exception
if not extracted_list:
print(f'No stack for {task!r}', file=file)
elif exc is not None:
print(f'Traceback for {task!r} (most recent call last):', file=file)
else:
print(f'Stack for {task!r} (most recent call last):', file=file)
traceback.print_list(extracted_list, file=file)
if exc is not None:
for line in traceback.format_exception_only(exc.__class__, exc):
print(line, file=file, end='')