GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-156466: fix cleanup on error in codegen_setup_annotations_scope (#… · python/cpython@24e5a55

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Python
    • codegen.c
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Python/codegen.c‎

Copy file name to clipboardExpand all lines: Python/codegen.c
+16-9Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -707,16 +707,8 @@ codegen_enter_scope(compiler *c, identifier name, int scope_type,
707707
}
708708

709709
static int
710-
codegen_setup_annotations_scope(compiler *c, location loc,
711-
void *key, PyObject *name)
710+
codegen_emit_annotations_prologue(compiler *c, location loc)
712711
{
713-
_PyCompile_CodeUnitMetadata umd = {
714-
.u_posonlyargcount = 1,
715-
};
716-
RETURN_IF_ERROR(
717-
codegen_enter_scope(c, name, COMPILE_SCOPE_ANNOTATIONS,
718-
key, loc.lineno, NULL, &umd));
719-
720712
// if .format > VALUE_WITH_FAKE_GLOBALS: raise NotImplementedError
721713
PyObject *value_with_fake_globals = PyLong_FromLong(_Py_ANNOTATE_FORMAT_VALUE_WITH_FAKE_GLOBALS);
722714
if (value_with_fake_globals == NULL) {
@@ -736,6 +728,21 @@ codegen_setup_annotations_scope(compiler *c, location loc,
736728
return SUCCESS;
737729
}
738730

731+
static int
732+
codegen_setup_annotations_scope(compiler *c, location loc,
733+
void *key, PyObject *name)
734+
{
735+
_PyCompile_CodeUnitMetadata umd = {
736+
.u_posonlyargcount = 1,
737+
};
738+
RETURN_IF_ERROR(
739+
codegen_enter_scope(c, name, COMPILE_SCOPE_ANNOTATIONS,
740+
key, loc.lineno, NULL, &umd));
741+
742+
RETURN_IF_ERROR_IN_SCOPE(c, codegen_emit_annotations_prologue(c, loc));
743+
return SUCCESS;
744+
}
745+
739746
static int
740747
codegen_rename_annotations_format_param(PyCodeObject *co)
741748
{

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.