Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Python/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -775,10 +775,11 @@ codegen_rename_annotations_format_param(PyCodeObject *co)
}

static int
codegen_leave_annotations_scope(compiler *c, location loc)
codegen_finish_annotations_scope(compiler *c, location loc)
{
ADDOP_IN_SCOPE(c, loc, RETURN_VALUE);
PyCodeObject *co = _PyCompile_OptimizeAndAssemble(c, 1);
_PyCompile_ExitScope(c);
if (co == NULL) {
return ERROR;
}
Expand All @@ -788,7 +789,6 @@ codegen_leave_annotations_scope(compiler *c, location loc)
return ERROR;
}

_PyCompile_ExitScope(c);
int ret = codegen_make_closure(c, loc, co, 0);
Py_DECREF(co);
RETURN_IF_ERROR(ret);
Expand Down Expand Up @@ -891,7 +891,7 @@ codegen_process_deferred_annotations(compiler *c, location loc)
Py_DECREF(deferred_anno);
Py_DECREF(conditional_annotation_indices);

RETURN_IF_ERROR(codegen_leave_annotations_scope(c, loc));
RETURN_IF_ERROR(codegen_finish_annotations_scope(c, loc));
RETURN_IF_ERROR(codegen_nameop(
c, loc,
ste->ste_type == ClassBlock ? &_Py_ID(__annotate_func__) : &_Py_ID(__annotate__),
Expand Down Expand Up @@ -1197,7 +1197,7 @@ codegen_function_annotations(compiler *c, location loc,
c, codegen_annotations_in_scope(c, loc, args, returns, &annotations_len)
);
ADDOP_I_IN_SCOPE(c, loc, BUILD_MAP, annotations_len);
RETURN_IF_ERROR(codegen_leave_annotations_scope(c, loc));
RETURN_IF_ERROR(codegen_finish_annotations_scope(c, loc));
return MAKE_FUNCTION_ANNOTATE;
}
else {
Expand Down
Loading