mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 09:36:48 +03:00
Add locals on callable exception
This commit is contained in:
parent
cef6d35cfd
commit
9273ab3c45
|
@ -477,6 +477,8 @@ cdef inline void __async_prepare_args_kwargs_callback(
|
||||||
for value, (key, _) in zip(result, future_args_kwargs):
|
for value, (key, _) in zip(result, future_args_kwargs):
|
||||||
args[key] = value
|
args[key] = value
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
|
exception.__traceback__.tb_frame.f_locals.clear()
|
||||||
|
exception.__traceback__.tb_frame.f_locals.update(locals())
|
||||||
future_result.set_exception(exception)
|
future_result.set_exception(exception)
|
||||||
else:
|
else:
|
||||||
future_result.set_result(args)
|
future_result.set_result(args)
|
||||||
|
@ -525,6 +527,8 @@ cdef inline void __async_inject_attributes_callback(object future_result, object
|
||||||
for name, value in attributes.items():
|
for name, value in attributes.items():
|
||||||
setattr(instance, name, value)
|
setattr(instance, name, value)
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
|
exception.__traceback__.tb_frame.f_locals.clear()
|
||||||
|
exception.__traceback__.tb_frame.f_locals.update(locals())
|
||||||
future_result.set_exception(exception)
|
future_result.set_exception(exception)
|
||||||
else:
|
else:
|
||||||
future_result.set_result(instance)
|
future_result.set_result(instance)
|
||||||
|
@ -575,15 +579,20 @@ cdef inline object __call(
|
||||||
asyncio.ensure_future(args_kwargs_ready)
|
asyncio.ensure_future(args_kwargs_ready)
|
||||||
|
|
||||||
return future_result
|
return future_result
|
||||||
|
try:
|
||||||
return call(*args, **kwargs)
|
return call(*args, **kwargs)
|
||||||
|
except Exception as exception:
|
||||||
|
exception.__traceback__.tb_frame.f_locals.clear()
|
||||||
|
exception.__traceback__.tb_frame.f_locals.update(locals())
|
||||||
|
raise exception
|
||||||
|
|
||||||
cdef inline void __async_call_callback(object future_result, object call, object future):
|
cdef inline void __async_call_callback(object future_result, object call, object future):
|
||||||
try:
|
try:
|
||||||
args, kwargs = future.result()
|
args, kwargs = future.result()
|
||||||
result = call(*args, **kwargs)
|
result = call(*args, **kwargs)
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
|
exception.__traceback__.tb_frame.f_locals.clear()
|
||||||
|
exception.__traceback__.tb_frame.f_locals.update(locals())
|
||||||
future_result.set_exception(exception)
|
future_result.set_exception(exception)
|
||||||
else:
|
else:
|
||||||
if __is_future_or_coroutine(result):
|
if __is_future_or_coroutine(result):
|
||||||
|
@ -597,6 +606,8 @@ cdef inline object __async_result_callback(object future_result, object future):
|
||||||
try:
|
try:
|
||||||
result = future.result()
|
result = future.result()
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
|
exception.__traceback__.tb_frame.f_locals.clear()
|
||||||
|
exception.__traceback__.tb_frame.f_locals.update(locals())
|
||||||
future_result.set_exception(exception)
|
future_result.set_exception(exception)
|
||||||
else:
|
else:
|
||||||
future_result.set_result(result)
|
future_result.set_result(result)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user