Skip to content

Commit

Permalink
Cache uses WeakKeyDictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev committed May 2, 2015
1 parent a245180 commit 511090a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sympy/core/cache.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
""" Caching facility for SymPy """
from __future__ import print_function, division

import weakref

# TODO: refactor CACHE & friends into class?

# global cache registry:
Expand Down Expand Up @@ -77,7 +79,7 @@ def __cacheit(func):
set environment variable SYMPY_USE_CACHE to 'debug'
"""

func._cache_it_cache = func_cache_it_cache = {}
func._cache_it_cache = func_cache_it_cache = weakref.WeakKeyDictionary()
CACHE.append((func, func_cache_it_cache))

@wraps(func)
Expand Down

0 comments on commit 511090a

Please sign in to comment.