Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
tweaks
  • Loading branch information
JelleZijlstra committed Mar 14, 2025
commit ed79a88cda76e2e6925c679a03896c0aae41b089
2 changes: 2 additions & 0 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,7 @@ _PyCompile_EnterConditionalBlock(struct _PyCompiler *c)
void
_PyCompile_LeaveConditionalBlock(struct _PyCompiler *c)
{
assert(c->u->u_in_conditional_block > 0);
c->u->u_in_conditional_block--;
Comment thread
JelleZijlstra marked this conversation as resolved.
Resolved
}

Expand Down Expand Up @@ -1166,6 +1167,7 @@ _PyCompile_AddDeferredAnnotation(compiler *c, stmt_ty s,
Py_DECREF(index);
return ERROR;
}
Py_DECREF(index);
return SUCCESS;
}

Expand Down
3 changes: 2 additions & 1 deletion Python/symtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -2730,7 +2730,8 @@ symtable_visit_annotation(struct symtable *st, expr_ty annotation, void *key)
{
if ((st->st_cur->ste_type == ClassBlock || st->st_cur->ste_type == ModuleBlock)
&& st->st_cur->ste_in_conditional_block
&& !st->st_cur->ste_has_conditional_annotations) {
&& !st->st_cur->ste_has_conditional_annotations)
{
st->st_cur->ste_has_conditional_annotations = 1;
if (!symtable_add_def(st, &_Py_ID(__conditional_annotations__), USE, LOCATION(annotation))) {
return 0;
Expand Down