summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_weakref.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-09-09 14:55:58 (GMT)
committerGitHub <noreply@github.com>2019-09-09 14:55:58 (GMT)
commita2af05a0d3f0da06b8d432f52efa3ecf29038532 (patch)
tree3cdd6eee59dc6568efd7abe1b15fe1a863d86329 /Lib/test/test_weakref.py
parentb3b48c81f09d1472010937f1331c5a208a2a2d48 (diff)
downloadcpython-a2af05a0d3f0da06b8d432f52efa3ecf29038532.zip
cpython-a2af05a0d3f0da06b8d432f52efa3ecf29038532.tar.gz
cpython-a2af05a0d3f0da06b8d432f52efa3ecf29038532.tar.bz2
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.
Diffstat (limited to 'Lib/test/test_weakref.py')
-rw-r--r--Lib/test/test_weakref.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py
index 41f78e7..e14df9e 100644
--- a/Lib/test/test_weakref.py
+++ b/Lib/test/test_weakref.py
@@ -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