File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3223,7 +3223,6 @@ def __init__(
32233223 super ().__init__ (line , column )
32243224 self .value = value
32253225 self .fallback = fallback
3226- self ._hash = - 1 # Cached hash value
32273226
32283227 # NOTE: Enum types are always truthy by default, but this can be changed
32293228 # in subclasses, so we need to get the truthyness from the Enum
@@ -3253,13 +3252,12 @@ def accept(self, visitor: TypeVisitor[T]) -> T:
32533252 return visitor .visit_literal_type (self )
32543253
32553254 def __hash__ (self ) -> int :
3256- if self ._hash == - 1 :
3257- self ._hash = hash ((self .value , self .fallback ))
3258- return self ._hash
3255+ # Intentionally a subset of __eq__ for perf
3256+ return hash (self .value )
32593257
32603258 def __eq__ (self , other : object ) -> bool :
32613259 if isinstance (other , LiteralType ):
3262- return self .fallback == other .fallback and self .value == other .value
3260+ return self .value == other .value and self .fallback == other .fallback
32633261 else :
32643262 return NotImplemented
32653263
You can’t perform that action at this time.
0 commit comments