mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-38006: Avoid closure in weakref.WeakValueDictionary (GH-15641)
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.
This commit is contained in:
parent
b3b48c81f0
commit
a2af05a0d3
3 changed files with 10 additions and 2 deletions
|
@ -1792,6 +1792,11 @@ class MappingTestCase(TestBase):
|
|||
# copying should not result in a crash.
|
||||
self.check_threaded_weak_dict_copy(weakref.WeakValueDictionary, True)
|
||||
|
||||
@support.cpython_only
|
||||
def test_remove_closure(self):
|
||||
d = weakref.WeakValueDictionary()
|
||||
self.assertIsNone(d._remove.__closure__)
|
||||
|
||||
|
||||
from test import mapping_tests
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue