If all awaitables are completed successfully, the result is an aggregate list of returned values. The order of result values corresponds to the order of awaitables in aws.
import sys
import traceback
def raising_func():
1/0
#перехватывающая функция
def stack_capture(func):
try:
func()
except Exception:
_, _, tb = sys.exc_info()
return tb
#вызов
def some():
my_tb = stack_capture(raising_func)
return my_tb
traceback.print_tb(some())
Вывод:
File "__init__.py", line 13, in stack_capture
func()
File "__init__.py", line 7, in raising_func
1/0