From 742da040db28e1284615e88874d5c952da80344e Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 7 Sep 2016 17:40:12 -0700 Subject: Implement compact dict Issue #27350: `dict` implementation is changed like PyPy. It is more compact and preserves insertion order. _PyDict_Dummy() function has been removed. Disable test_gdb: python-gdb.py is not updated yet to the new structure of compact dictionaries (issue #28023). Patch written by INADA Naoki. --- Lib/test/test_weakref.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Lib/test/test_weakref.py') diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py index b1476d0a1a6..6e6990cd58f 100644 --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -1325,13 +1325,16 @@ class MappingTestCase(TestBase): o = Object(123456) with testcontext(): n = len(dict) - dict.popitem() + # Since underlaying dict is ordered, first item is popped + dict.pop(next(dict.keys())) self.assertEqual(len(dict), n - 1) dict[o] = o self.assertEqual(len(dict), n) + # last item in objects is removed from dict in context shutdown with testcontext(): self.assertEqual(len(dict), n - 1) - dict.pop(next(dict.keys())) + # Then, (o, o) is popped + dict.popitem() self.assertEqual(len(dict), n - 2) with testcontext(): self.assertEqual(len(dict), n - 3) -- cgit v1.2.3