mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
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:
parent
d8b7770a0e
commit
742da040db
12 changed files with 793 additions and 569 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue