From 32704bf4ebd680f47cc4ba80ef786ef74fd0d974 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sat, 2 May 2015 19:33:25 +0300 Subject: [PATCH] Add weakref support for Symbols, fix sympy/sympy#8825 At this commit:: $ ./bin/isympy -q Python console for SymPy 0.7.6-git (Python 2.7.3-64-bit) (ground types: python) >>> import weakref >>> d = weakref.WeakKeyDictionary([(x,1), (y, 2)]) >>> print(d.items()) [(x, 1), (y, 2)] >>> del x >>> print(d.items()) [(y, 2)] --- sympy/core/symbol.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sympy/core/symbol.py b/sympy/core/symbol.py index eb8d802e1cc..d8e111ed777 100644 --- a/sympy/core/symbol.py +++ b/sympy/core/symbol.py @@ -34,7 +34,7 @@ class Symbol(AtomicExpr, Boolean): is_comparable = False - __slots__ = ['name'] + __slots__ = ['name', '__weakref__'] is_Symbol = True