Issue #28739: f-string expressions no longer accepted as docstrings and

by ast.literal_eval() even if they do not include subexpressions.
This commit is contained in:
Serhiy Storchaka 2016-12-11 19:37:19 +02:00
parent 8114f21668
commit 4cc30ae313
4 changed files with 20 additions and 17 deletions

View file

@ -3415,7 +3415,8 @@ static int
compiler_joined_str(struct compiler *c, expr_ty e)
{
VISIT_SEQ(c, expr, e->v.JoinedStr.values);
ADDOP_I(c, BUILD_STRING, asdl_seq_LEN(e->v.JoinedStr.values));
if (asdl_seq_LEN(e->v.JoinedStr.values) != 1)
ADDOP_I(c, BUILD_STRING, asdl_seq_LEN(e->v.JoinedStr.values));
return 1;
}