1, pending exception
import sysclass CustomException(Exception):"""Wrap arbitrary pending exception,if any, in addition to other info."""def __init__(self, *args):Exception.__init__(self, *args)self.wrapped_exc = sys.exc_info()def call_wrapped(callable, *args, **kwargs):try:return callable(*args, **kwargs)except:raise CustomException('Wrapped function ''propagated exception')def f(x):return 1 / xa = call_wrapped(f, 0)print(a)
