From ffbcc689da526cebc7b18f116fef1f53350b75f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Hordy=C5=84ski?= <26008518+mhordynski@users.noreply.github.com> Date: Fri, 29 Nov 2024 14:52:40 +0100 Subject: [PATCH] fix: context var using default mutable value (#214) --- packages/ragbits-core/src/ragbits/core/audit/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/ragbits-core/src/ragbits/core/audit/base.py b/packages/ragbits-core/src/ragbits/core/audit/base.py index d0e9f7fd..b8f1a745 100644 --- a/packages/ragbits-core/src/ragbits/core/audit/base.py +++ b/packages/ragbits-core/src/ragbits/core/audit/base.py @@ -18,7 +18,8 @@ def __init__(self) -> None: Constructs a new TraceHandler instance. """ super().__init__() - self._spans = ContextVar[list[SpanT]]("_spans", default=[]) + self._spans = ContextVar[list[SpanT]]("_spans") + self._spans.set([]) @abstractmethod def start(self, name: str, inputs: dict, current_span: SpanT | None = None) -> SpanT: