diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_ordered_dict.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_ordered_dict.py b/Lib/test/test_ordered_dict.py index 9d6c6ff..8ab0a9f 100644 --- a/Lib/test/test_ordered_dict.py +++ b/Lib/test/test_ordered_dict.py @@ -1,10 +1,12 @@ import contextlib import copy +import gc import pickle from random import randrange, shuffle import struct import sys import unittest +import weakref from collections.abc import MutableMapping from test import mapping_tests, support @@ -585,6 +587,17 @@ class OrderedDictTests: dict.update(od, [('spam', 1)]) self.assertNotIn('NULL', repr(od)) + def test_reference_loop(self): + # Issue 25935 + OrderedDict = self.OrderedDict + class A: + od = OrderedDict() + A.od[A] = None + r = weakref.ref(A) + del A + gc.collect() + self.assertIsNone(r()) + class PurePythonOrderedDictTests(OrderedDictTests, unittest.TestCase): |