Skip to content

Commit 3676a50

Browse files
committed
code review
1 parent ca1b8e3 commit 3676a50

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

Lib/test/test_typing.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2368,8 +2368,9 @@ def foo(a: c1_gth, b: c2_gth):
23682368
self.assertEqual(c1, c2)
23692369
self.assertEqual(c1, c1_gth)
23702370
self.assertEqual(c1_gth, c2_gth)
2371-
self.assertEqual(Union[c1], Union[c1_gth])
2372-
self.assertEqual(Union[c1, c1_gth, c2, c2_gth], Union[c1])
2371+
self.assertEqual(List[c1], List[c1_gth])
2372+
self.assertNotEqual(List[c1], List[C])
2373+
self.assertNotEqual(List[c1_gth], List[C])
23732374

23742375
def test_forward_equality_hash(self):
23752376
c1 = typing.ForwardRef('int')

Lib/typing.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,7 @@ def _remove_dups_flatten(parameters):
230230
else:
231231
params.append(p)
232232
# Weed out strict duplicates, preserving the first of each occurrence.
233-
new_params = []
234-
for p in params:
235-
if p not in new_params:
236-
new_params.append(p)
237-
params = new_params
238-
return tuple(params)
233+
return tuple(dict.fromkeys(params))
239234

240235

241236
_cleanups = []

0 commit comments

Comments
 (0)