diff --git a/numexpr/utils.py b/numexpr/utils.py index 9acdb0b..cc61833 100644 --- a/numexpr/utils.py +++ b/numexpr/utils.py @@ -236,7 +236,7 @@ def __init__(self): self._context_data = contextvars.ContextVar('context_data', default={}) def set(self, key=None, value=None, **kwargs): - data = self._context_data.get() + data = self._context_data.get().copy() if key is not None: data[key] = value @@ -251,7 +251,7 @@ def get(self, key, default=None): return data.get(key, default) def delete(self, key): - data = self._context_data.get() + data = self._context_data.get().copy() if key in data: del data[key] self._context_data.set(data) @@ -263,7 +263,7 @@ def all(self): return self._context_data.get() def update(self, *args, **kwargs): - data = self._context_data.get() + data = self._context_data.get().copy() if args: if len(args) > 1: