Skip to content
Merged
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
change to goto error in scope var cleanup and remove uncessary comments
  • Loading branch information
A0su committed Mar 28, 2026
commit 5b82b9416e01def97aa2d4968ed7620efbaa3477
7 changes: 3 additions & 4 deletions Python/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ codegen_setup_annotations_scope(compiler *c, location loc,
assert(!SYMTABLE_ENTRY(c)->ste_has_docstring);
_Py_DECLARE_STR(format, ".format");
ADDOP_I(c, loc, LOAD_FAST, 0);
ADDOP_LOAD_CONST_NEW(c, loc, value_with_fake_globals); // macro handles decref of value_with_fake_globals
ADDOP_LOAD_CONST_NEW(c, loc, value_with_fake_globals);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a real bugfix, but in practice _Py_ANNOTATE_FORMAT_VALUE_WITH_FAKE_GLOBALS=2 which is an immortal small integer, and so refcount is not really an issue. It's not worth it to backport this change in practice.

ADDOP_I(c, loc, COMPARE_OP, (Py_GT << 5) | compare_masks[Py_GT]);
NEW_JUMP_TARGET_LABEL(c, body);
ADDOP_JUMP(c, loc, POP_JUMP_IF_FALSE, body);
Expand Down Expand Up @@ -823,7 +823,7 @@ codegen_deferred_annotations_body(compiler *c, location loc,

VISIT(c, expr, st->v.AnnAssign.annotation);
ADDOP_I(c, LOC(st), COPY, 2);
ADDOP_LOAD_CONST_NEW(c, LOC(st), mangled); // macro handles decref of mangle
ADDOP_LOAD_CONST_NEW(c, LOC(st), mangled);
// stack now contains <annos> <name> <annos> <value>
ADDOP(c, loc, STORE_SUBSCR);
// stack now contains <annos>
Expand Down Expand Up @@ -3287,8 +3287,7 @@ codegen_nameop(compiler *c, location loc,

int scope = _PyST_GetScope(SYMTABLE_ENTRY(c), mangled);
if (scope == -1) {
Py_DECREF(mangled);
return ERROR;
goto error;
}

_PyCompile_optype optype;
Expand Down
Loading