[pypy-issue] Issue #2146: WeakKeyDictionary has some bugs (pypy/pypy)

kmod issues-reply at bitbucket.org
Fri Sep 25 22:29:05 CEST 2015

New issue 2146: WeakKeyDictionary has some bugs


It looks like PyPy uses the CPython implementation of WeakKeyDictionary and WeakValueDictionary, but that implementation relies on quick destruction.  It looks like PyPy (2.6.0) has a fix for the WeakValueDictionary case, but WeakKeyDictionary has the same issue (the callback can be postponed to the point that it removes the wrong entry from the dict).

Here's Pyston's solution (and corresponding test), which I think should work for PyPy but I haven't tested it:

More information about the pypy-issue mailing list