Skip to content

Commit 0fd504c

Browse files
committed
Fix bug caused by bad ParameterizedClass hashing.
Set comparisons use hashes, and ParameterizedClass.__hash__ produces different results depending on whether its type parameters have been evaluated. We really need to fix this, but in the meantime, this tweak to matcher.py works around the problem. PiperOrigin-RevId: 600620172
1 parent 365c140 commit 0fd504c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

pytype/matcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ def _match_type_param_against_type_param(self, t1, t2, subst, view):
474474
# constraints even if t1 is bounded.
475475
if not t1.constraints:
476476
return None # t1 is unconstrained, t2 has constraints
477-
if set(t1.constraints) - set(t2.constraints):
477+
if any(c not in t2.constraints for c in t1.constraints):
478478
return None # t1 is more permissive than t2
479479
elif t2.bound:
480480
if t1.bound:

0 commit comments

Comments
 (0)