diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-09-07 17:40:12 -0700 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-09-07 17:40:12 -0700 |
commit | 742da040db28e1284615e88874d5c952da80344e (patch) | |
tree | cab46d2fca910251fdfd92e248a2a484246f9354 /Lib/test/test_weakref.py | |
parent | d8b7770a0e4a79280a3b5346ae8a6593ea74facf (diff) | |
download | cpython-742da040db28e1284615e88874d5c952da80344e.tar.gz cpython-742da040db28e1284615e88874d5c952da80344e.zip |
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.
Diffstat (limited to 'Lib/test/test_weakref.py')
-rw-r--r-- | Lib/test/test_weakref.py | 7 |
1 files changed, 5 insertions, 2 deletions
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) |