Skip to content

Commit

Permalink
isolate dict between contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
Emma Ai committed Sep 12, 2024
1 parent cb5faa1 commit c4f527d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions numexpr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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:
Expand Down

0 comments on commit c4f527d

Please sign in to comment.