Skip to content

Commit ff26ebf

Browse files
committed
Use hash-based deduplication for constraints
1 parent 48bc430 commit ff26ebf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mypy/constraints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def infer_constraints_for_callable(
272272
)
273273
)
274274

275-
constraints = [c for i, c in enumerate(constraints) if c not in constraints[:i]]
275+
constraints = list(dict.fromkeys(constraints))
276276
if any(isinstance(v, ParamSpecType) for v in callee.variables):
277277
# As a perf optimization filter imprecise constraints only when we can have them.
278278
constraints = filter_imprecise_kinds(constraints)

0 commit comments

Comments
 (0)