@@ -707,16 +707,8 @@ codegen_enter_scope(compiler *c, identifier name, int scope_type, |
707 | 707 | } |
708 | 708 |
|
709 | 709 | 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) |
712 | 711 | { |
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 | | - |
720 | 712 | // if .format > VALUE_WITH_FAKE_GLOBALS: raise NotImplementedError |
721 | 713 | PyObject *value_with_fake_globals = PyLong_FromLong(_Py_ANNOTATE_FORMAT_VALUE_WITH_FAKE_GLOBALS); |
722 | 714 | if (value_with_fake_globals == NULL) { |
@@ -736,6 +728,21 @@ codegen_setup_annotations_scope(compiler *c, location loc, |
736 | 728 | return SUCCESS; |
737 | 729 | } |
738 | 730 |
|
| 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 | + |
739 | 746 | static int |
740 | 747 | codegen_rename_annotations_format_param(PyCodeObject *co) |
741 | 748 | { |
|