Skip to content

Commit 8f2a781

Browse files
committed
Fix __annotate__ docstring
1 parent f135b69 commit 8f2a781

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Python/codegen.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,9 @@ codegen_setup_annotations_scope(compiler *c, location loc,
664664
codegen_enter_scope(c, name, COMPILE_SCOPE_ANNOTATIONS,
665665
key, loc.lineno, NULL, &umd));
666666

667+
// Insert None into consts to prevent an annotation
668+
// apperaing to be a docstring
669+
_PyCompile_AddConst(c, Py_None);
667670
// if .format != 1: raise NotImplementedError
668671
_Py_DECLARE_STR(format, ".format");
669672
ADDOP_I(c, loc, LOAD_FAST, 0);

0 commit comments

Comments
 (0)