Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9abd18a

Browse files
committed
add locals for async exceptions
1 parent 4de3fa7 commit 9abd18a

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

‎src/dependency_injector/providers.pxd‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,8 @@ cdef inline void __async_prepare_args_kwargs_callback(
477477
for value, (key, _) in zip(result, future_args_kwargs):
478478
args[key] = value
479479
except Exception as exception:
480+
exception.__traceback__.tb_frame.f_locals.clear()
481+
exception.__traceback__.tb_frame.f_locals.update(locals())
480482
future_result.set_exception(exception)
481483
else:
482484
future_result.set_result(args)
@@ -525,6 +527,8 @@ cdef inline void __async_inject_attributes_callback(object future_result, object
525527
for name, value in attributes.items():
526528
setattr(instance, name, value)
527529
except Exception as exception:
530+
exception.__traceback__.tb_frame.f_locals.clear()
531+
exception.__traceback__.tb_frame.f_locals.update(locals())
528532
future_result.set_exception(exception)
529533
else:
530534
future_result.set_result(instance)
@@ -577,16 +581,18 @@ cdef inline object __call(
577581
return future_result
578582
try:
579583
return call(*args, **kwargs)
580-
except Exception as e:
581-
e.__traceback__.tb_frame.f_locals.clear()
582-
e.__traceback__.tb_frame.f_locals.update(locals())
583-
raise e
584+
except Exception as exception:
585+
exception.__traceback__.tb_frame.f_locals.clear()
586+
exception.__traceback__.tb_frame.f_locals.update(locals())
587+
raise exception
584588

585589
cdef inline void __async_call_callback(object future_result, object call, object future):
586590
try:
587591
args, kwargs = future.result()
588592
result = call(*args, **kwargs)
589593
except Exception as exception:
594+
exception.__traceback__.tb_frame.f_locals.clear()
595+
exception.__traceback__.tb_frame.f_locals.update(locals())
590596
future_result.set_exception(exception)
591597
else:
592598
if __is_future_or_coroutine(result):
@@ -600,6 +606,8 @@ cdef inline object __async_result_callback(object future_result, object future):
600606
try:
601607
result = future.result()
602608
except Exception as exception:
609+
exception.__traceback__.tb_frame.f_locals.clear()
610+
exception.__traceback__.tb_frame.f_locals.update(locals())
603611
future_result.set_exception(exception)
604612
else:
605613
future_result.set_result(result)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /