Skip to content

Commit

Permalink
Fix __annotate__ docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
markshannon committed Oct 25, 2024
1 parent f135b69 commit 8f2a781
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Python/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,9 @@ codegen_setup_annotations_scope(compiler *c, location loc,
codegen_enter_scope(c, name, COMPILE_SCOPE_ANNOTATIONS,
key, loc.lineno, NULL, &umd));

// Insert None into consts to prevent an annotation
// apperaing to be a docstring
_PyCompile_AddConst(c, Py_None);
// if .format != 1: raise NotImplementedError
_Py_DECLARE_STR(format, ".format");
ADDOP_I(c, loc, LOAD_FAST, 0);
Expand Down

0 comments on commit 8f2a781

Please sign in to comment.