summaryrefslogtreecommitdiffstats
path: root/Python/codegen.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/codegen.c')
-rw-r--r--Python/codegen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/codegen.c b/Python/codegen.c
index 2ca5db1..5565d30 100644
--- a/Python/codegen.c
+++ b/Python/codegen.c
@@ -746,7 +746,7 @@ _PyCodegen_Expression(compiler *c, expr_ty e)
and for annotations. */
int
-_PyCodegen_Body(compiler *c, location loc, asdl_stmt_seq *stmts)
+_PyCodegen_Body(compiler *c, location loc, asdl_stmt_seq *stmts, bool is_interactive)
{
/* If from __future__ import annotations is active,
* every annotated class and module should have __annotations__.
@@ -758,7 +758,7 @@ _PyCodegen_Body(compiler *c, location loc, asdl_stmt_seq *stmts)
return SUCCESS;
}
Py_ssize_t first_instr = 0;
- if (!IS_INTERACTIVE(c)) {
+ if (!is_interactive) { /* A string literal on REPL prompt is not a docstring */
PyObject *docstring = _PyAST_GetDocString(stmts);
if (docstring) {
first_instr = 1;
@@ -1432,7 +1432,7 @@ codegen_class_body(compiler *c, stmt_ty s, int firstlineno)
ADDOP_N_IN_SCOPE(c, loc, STORE_DEREF, &_Py_ID(__classdict__), cellvars);
}
/* compile the body proper */
- RETURN_IF_ERROR_IN_SCOPE(c, _PyCodegen_Body(c, loc, s->v.ClassDef.body));
+ RETURN_IF_ERROR_IN_SCOPE(c, _PyCodegen_Body(c, loc, s->v.ClassDef.body, false));
PyObject *static_attributes = _PyCompile_StaticAttributesAsTuple(c);
if (static_attributes == NULL) {
_PyCompile_ExitScope(c);