Skip to content
Snippets Groups Projects
Commit 0aefe844 authored by Dominic Kempf's avatar Dominic Kempf
Browse files

Fix cache_restoring context

parent 84603db1
No related branches found
No related tags found
No related merge requests found
...@@ -37,16 +37,17 @@ class _CacheRestoringContext(object): ...@@ -37,16 +37,17 @@ class _CacheRestoringContext(object):
def __enter__(self): def __enter__(self):
from dune.codegen.generation.cache import _generators as g from dune.codegen.generation.cache import _generators as g
self.cache = {} self.cache = {}
for i in g: for original_func, cache_func in g.items():
self.cache[i] = {} self.cache[original_func] = {}
for k, v in i._memoize_cache.items(): for k, v in cache_func._memoize_cache.items():
self.cache[i][k] = v self.cache[original_func][k] = v
def __exit__(self, exc_type, exc_value, traceback): def __exit__(self, exc_type, exc_value, traceback):
from dune.codegen.generation.cache import _generators as g
for i, c in self.cache.items(): for i, c in self.cache.items():
i._memoize_cache = {} g[i]._memoize_cache = {}
for k, v in c.items(): for k, v in c.items():
i._memoize_cache[k] = v g[i]._memoize_cache[k] = v
def cache_restoring(): def cache_restoring():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment