gh-124022: Fix bug where class docstring is removed in interactive mode (#124023)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
Irit Katriel 2024-09-13 15:06:06 +01:00 committed by GitHub
parent cfe6074d1f
commit a9594a34c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 37 additions and 12 deletions

View file

@ -790,13 +790,13 @@ compiler_codegen(compiler *c, mod_ty mod)
switch (mod->kind) {
case Module_kind: {
asdl_stmt_seq *stmts = mod->v.Module.body;
RETURN_IF_ERROR(_PyCodegen_Body(c, start_location(stmts), stmts));
RETURN_IF_ERROR(_PyCodegen_Body(c, start_location(stmts), stmts, false));
break;
}
case Interactive_kind: {
c->c_interactive = 1;
asdl_stmt_seq *stmts = mod->v.Interactive.body;
RETURN_IF_ERROR(_PyCodegen_Body(c, start_location(stmts), stmts));
RETURN_IF_ERROR(_PyCodegen_Body(c, start_location(stmts), stmts, true));
break;
}
case Expression_kind: {