Skip to content

Commit 41c3e64

Browse files
committed
Include less code within cell.cell_contents try-except block
1 parent 65c40d3 commit 41c3e64

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Lib/annotationlib.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,13 @@ def evaluate(
176176
# Similar logic can be used for nonlocals, which should not
177177
# override locals.
178178
if isinstance(self.__cell__, dict):
179-
for cell_name, cell_value in self.__cell__.items():
179+
for cell_name, cell in self.__cell__.items():
180180
try:
181-
locals.setdefault(cell_name, cell_value.cell_contents)
181+
cell_value = cell.cell_contents
182182
except ValueError:
183183
pass
184+
else:
185+
locals.setdefault(cell_name, cell_value)
184186

185187
if self.__extra_names__:
186188
locals.update(self.__extra_names__)

0 commit comments

Comments
 (0)