def tpool_reraise(func, *args, **kwargs):
 def inner():
  try:
   return func(*args, **kwargs)
  except BaseException as err:
   return err
 resp = tpool.execute(inner)
 if isinstance(resp, BaseException):
  raise resp
 return resp

def tpool_reraise ( func , * args , ** kwargs ) : def inner ( ) : try : return func ( * args , ** kwargs ) except BaseException as err : return err resp = tpool . execute ( inner ) if isinstance ( resp , BaseException ) : raise resp return resp
hack to work around eventlets tpool not catching and reraising timeouts .