(self)
| 951 | d = {} |
| 952 | |
| 953 | def test_container_iterator(self): |
| 954 | # Bug #3680: tp_traverse was not implemented for dictiter and |
| 955 | # dictview objects. |
| 956 | class C(object): |
| 957 | pass |
| 958 | views = (dict.items, dict.values, dict.keys) |
| 959 | for v in views: |
| 960 | obj = C() |
| 961 | ref = weakref.ref(obj) |
| 962 | container = {obj: 1} |
| 963 | obj.v = v(container) |
| 964 | obj.x = iter(obj.v) |
| 965 | del obj, container |
| 966 | gc.collect() |
| 967 | self.assertIs(ref(), None, "Cycle was not collected") |
| 968 | |
| 969 | def make_shared_key_dict(self, n): |
| 970 | class C: |