From f56d242b1d8fca88ed1f5447e91acbf77e0a5d77 Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Tue, 22 Oct 2024 00:23:34 -0400 Subject: [PATCH] fix: adding context to exc fails on some subtypes (#329) --- a_sync/a_sync/property.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/a_sync/a_sync/property.py b/a_sync/a_sync/property.py index 51ace610..a320f2e0 100644 --- a/a_sync/a_sync/property.py +++ b/a_sync/a_sync/property.py @@ -256,12 +256,8 @@ async def load_value(): try: value = await _smart.shield(inner_task) except Exception as e: - context = {"property": self, "instance": instance} - try: - context_added = type(e)(*e.args, context) - except TypeError: - raise e.with_traceback(e.__traceback__) - raise context_added.with_traceback(e.__traceback__) + e.args = *e.args, {"property": self, "instance": instance} + raise self.__set__(instance, value) self.pop_lock(instance) return value