We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 02b8a83 commit e20da27Copy full SHA for e20da27
1 file changed
Lib/annotationlib.py
@@ -171,16 +171,14 @@ def evaluate(
171
# as a way of emulating annotation scopes when calling `eval()`
172
if type_params is not None:
173
for param in type_params:
174
- if param.__name__ not in locals:
175
- locals[param.__name__] = param
+ locals.setdefault(param.__name__, param)
176
177
# Similar logic can be used for nonlocals, which should not
178
# override locals.
179
if isinstance(self.__cell__, dict):
180
for cell_name, cell_value in self.__cell__.items():
181
try:
182
- if cell_name not in locals:
183
- locals[cell_name] = cell_value.cell_contents
+ locals.setdefault(cell_name, cell_value.cell_contents)
184
except ValueError:
185
pass
186
0 commit comments