diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-06-16 13:29:42 (GMT) |
---|---|---|
committer | ericvsmith <ericvsmith@users.noreply.github.com> | 2017-06-16 13:29:42 (GMT) |
commit | 2eca5b465f7404cc8484457b7966f828f434ec20 (patch) | |
tree | 24eb2215c217bd8669b0f5da5e098f3ebf0cd3be /Python | |
parent | a0ccc54e6dffacf9e7c06f2a3e9056d2d35d21eb (diff) | |
download | cpython-2eca5b465f7404cc8484457b7966f828f434ec20.zip cpython-2eca5b465f7404cc8484457b7966f828f434ec20.tar.gz cpython-2eca5b465f7404cc8484457b7966f828f434ec20.tar.bz2 |
[3.6] bpo-30682: Removed a too-strict assertion that failed for certain f-strings. (GH-2232) (#2242)
This caused a segfault on eval("f'\\\n'") and eval("f'\\\r'") in debug build..
(cherry picked from commit 11e97f2f80bf65cc828c127eafc95229df35d403)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/ast.c b/Python/ast.c index c61ca4b..8d53736 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -4887,6 +4887,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 { @@ -4896,8 +4898,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. */ |