summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorericvsmith <ericvsmith@users.noreply.github.com>2017-06-16 10:19:32 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-06-16 10:19:32 (GMT)
commit11e97f2f80bf65cc828c127eafc95229df35d403 (patch)
tree69abcabdc0c46545eea7d33419655cd952fb9190 /Python
parenta49c935cfd6b4f8ea1f750888dd9260bbf5b9980 (diff)
downloadcpython-11e97f2f80bf65cc828c127eafc95229df35d403.zip
cpython-11e97f2f80bf65cc828c127eafc95229df35d403.tar.gz
cpython-11e97f2f80bf65cc828c127eafc95229df35d403.tar.bz2
bpo-30682: Removed a too-strict assertion that failed for certain f-strings. (#2232)
This caused a segfault on eval("f'\\\n'") and eval("f'\\\r'") in debug build.
Diffstat (limited to 'Python')
-rw-r--r--Python/ast.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/ast.c b/Python/ast.c
index 7551b6f..becf0ad 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -4914,6 +4914,8 @@ FstringParser_ConcatFstring(FstringParser *state, const char **str,
/* Do nothing. Just leave last_str alone (and possibly
NULL). */
} else if (!state->last_str) {
+ /* Note that the literal can be zero length, if the
+ input string is "\\\n" or "\\\r", among others. */
state->last_str = literal;
literal = NULL;
} else {
@@ -4923,8 +4925,6 @@ FstringParser_ConcatFstring(FstringParser *state, const char **str,
return -1;
literal = NULL;
}
- assert(!state->last_str ||
- PyUnicode_GET_LENGTH(state->last_str) != 0);
/* We've dealt with the literal now. It can't be leaked on further
errors. */