File tree 2 files changed +15
-0
lines changed
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,18 @@ def restore_path(self):
152
152
yield
153
153
self .path = path
154
154
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
+
155
167
def __str__ (self ) -> str :
156
168
state = (
157
169
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(
35
35
def inner (* args : _P .args , ** kwargs : _P .kwargs ) -> Iterator [InferenceResult ]:
36
36
node = args [0 ]
37
37
context = args [1 ]
38
+ if context .is_empty ():
39
+ # Fresh, empty contexts will defeat the cache.
40
+ context = None
38
41
try :
39
42
result = _cache [func , node , context ]
40
43
# If through recursion we end up trying to infer the same
You can’t perform that action at this time.
0 commit comments