summaryrefslogtreecommitdiff
path: root/Python/compile.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-12-11 19:37:19 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2016-12-11 19:37:19 +0200
commit3759dfc49056abec76793c75729aa85eea4f32cd (patch)
treec2899583a8b5c462ddbe98ee8e04ef17d4c1b2cb /Python/compile.c
parent5cc7aee764173c00a75ce15fc831cf35ea4b24f4 (diff)
downloadcpython-3759dfc49056abec76793c75729aa85eea4f32cd.tar.gz
Issue #28739: f-string expressions no longer accepted as docstrings and
by ast.literal_eval() even if they do not include subexpressions.
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 35151cdd59..0e16075852 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -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;
}