[3.7] bpo-38006: Avoid closure in weakref.WeakValueDictionary (GH-15641) by vstinner · Pull Request #15789 · python/cpython
weakref.WeakValueDictionary defines a local remove() function used as
callback for weak references. This function was created with a
closure. Modify the implementation to avoid the closure.
(cherry picked from commit a2af05a)