Skip to content

Commit b600f8c

Browse files
committed
Fix __code__ access in _build_closure for non-func annotates
1 parent d98ef64 commit b600f8c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/annotationlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ def _build_closure(annotate, owner, is_class, stringifier_dict, *, allow_evaluat
854854
closure = _get_annotate_attr(annotate, "__closure__", None)
855855
if not closure:
856856
return None, None
857-
freevars = annotate.__code__.co_freevars
857+
freevars = _get_annotate_attr(annotate, "__code__", None).co_freevars
858858
new_closure = []
859859
cell_dict = {}
860860
for i, cell in enumerate(closure):

0 commit comments

Comments
 (0)