Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-94808: Improve coverage of dictresize #100619

Merged
merged 1 commit into from
Dec 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Lib/test/test_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,21 @@ def __init__(self, order):
d.update(o.__dict__)
self.assertEqual(list(d), ["c", "b", "a"])

@support.cpython_only
def test_splittable_to_generic_combinedtable(self):
"""split table must be correctly resized and converted to generic combined table"""
class C:
pass

a = C()
a.x = 1
d = a.__dict__
before_resize = sys.getsizeof(d)
d[2] = 2 # split table is resized to a generic combined table

self.assertGreater(sys.getsizeof(d), before_resize)
self.assertEqual(list(d), ['x', 2])

def test_iterator_pickling(self):
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
data = {1:"a", 2:"b", 3:"c"}
Expand Down