File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -152,6 +152,18 @@ def restore_path(self):
152152 yield
153153 self .path = path
154154
155+ def is_empty (self ) -> bool :
156+ return (
157+ not self .path
158+ and not self .nodes_inferred
159+ and not self .callcontext
160+ and not self .boundnode
161+ and not self .lookupname
162+ and not self .callcontext
163+ and not self .extra_context
164+ and not self .constraints
165+ )
166+
155167 def __str__ (self ) -> str :
156168 state = (
157169 f"{ field } ={ pprint .pformat (getattr (self , field ), width = 80 - len (field ))} "
Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ def _inference_tip_cached(
3535 def inner (* args : _P .args , ** kwargs : _P .kwargs ) -> Iterator [InferenceResult ]:
3636 node = args [0 ]
3737 context = args [1 ]
38+ if context .is_empty ():
39+ # Fresh, empty contexts will defeat the cache.
40+ context = None
3841 try :
3942 result = _cache [func , node , context ]
4043 # If through recursion we end up trying to infer the same
You can’t perform that action at this time.
0 commit comments