Skip to content
Merged
Show file tree
Hide file tree
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
17 changes: 17 additions & 0 deletions Lib/test/test_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,23 @@ def test_splittable_popitem(self):
self.assertEqual(list(a), ['x', 'y'])
self.assertEqual(list(b), ['x', 'y', 'z'])

@support.cpython_only
def test_splittable_update(self):
"""dict.update(other) must preserve order in other."""
class C:
def __init__(self, order):
if order:
self.a, self.b, self.c = 1, 2, 3
else:
self.c, self.b, self.a = 1, 2, 3
o = C(True)
o = C(False) # o.__dict__ has reversed order.
self.assertEqual(list(o.__dict__), ["c", "b", "a"])

d = {}
d.update(o.__dict__)
self.assertEqual(list(d), ["c", "b", "a"])

def test_iterator_pickling(self):
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
data = {1:"a", 2:"b", 3:"c"}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix regression that dict.update(other) may don't respect iterate order of
other when other is key sharing dict.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
In :func:`typing.get_type_hints`, support evaluating stringified ``ParamSpecArgs`` and ``ParamSpecKwargs`` annotations. Patch by Gregory Beauregard.
In :func:`typing.get_type_hints`, support evaluating stringified ``ParamSpecArgs`` and ``ParamSpecKwargs`` annotations. Patch by Gregory Beauregard.