Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use WeakValueDictionary in cache #193

Closed
wants to merge 9 commits into from
Closed

Use WeakValueDictionary in cache #193

wants to merge 9 commits into from

Conversation

skirpichev
Copy link
Member

This fixes sympy/sympy#8825:

>>> import weakref
>>> import sympy
>>> x, y = sympy.Symbol('x'), sympy.Symbol('y')
>>> d = weakref.WeakKeyDictionary([(x, 1), (y, 2)])
>>> print(list(d.items()))
[(y, 2), (x, 1)]
>>> del x
>>> print(list(d.items()))
[(y, 2)]

Cache now uses WeakValueDictionary.

@skirpichev skirpichev added enhancement new feature requests (or implementation) core caching labels Jan 17, 2016
@skirpichev skirpichev force-pushed the weakref branch 2 times, most recently from cf0d8a3 to 27702fe Compare January 25, 2016 11:28
@skirpichev skirpichev changed the title Add weakref support for Basic's Use WeakValueDictionary in cache Feb 2, 2016
This fixes sympy/sympy#8825:

    >>> import weakref
    >>> import sympy
    >>> x, y = sympy.Symbol('x'), sympy.Symbol('y')
    >>> d = weakref.WeakKeyDictionary([(x, 1), (y, 2)])
    >>> print(list(d.items()))
    [(y, 2), (x, 1)]
    >>> del x
    >>> print(list(d.items()))
    [(y, 2)]

Cache now uses WeakValueDictionary.
@skirpichev skirpichev closed this May 12, 2016
@skirpichev skirpichev deleted the weakref branch May 12, 2016 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
caching core enhancement new feature requests (or implementation) performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't use both weakref's & cache
1 participant