File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,18 @@ def restore_path(self) -> Iterator[None]:
140
140
yield
141
141
self .path = path
142
142
143
+ def is_empty (self ) -> bool :
144
+ return (
145
+ not self .path
146
+ and not self .nodes_inferred
147
+ and not self .callcontext
148
+ and not self .boundnode
149
+ and not self .lookupname
150
+ and not self .callcontext
151
+ and not self .extra_context
152
+ and not self .constraints
153
+ )
154
+
143
155
def __str__ (self ) -> str :
144
156
state = (
145
157
f"{ field } ={ pprint .pformat (getattr (self , field ), width = 80 - len (field ))} "
Original file line number Diff line number Diff line change @@ -46,6 +46,9 @@ def inner(
46
46
# func + node we raise here.
47
47
_CURRENTLY_INFERRING .remove (partial_cache_key )
48
48
raise UseInferenceDefault
49
+ if context is not None and context .is_empty ():
50
+ # Fresh, empty contexts will defeat the cache.
51
+ context = None
49
52
try :
50
53
yield from _cache [func , node , context ]
51
54
return
You can’t perform that action at this time.
0 commit comments