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.
This commit is contained in:
Victor Stinner 2016-09-07 17:40:12 -07:00
parent d8b7770a0e
commit 742da040db
12 changed files with 793 additions and 569 deletions

View file

@ -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)