mirror of
https://github.com/python/cpython.git
synced 2025-10-05 06:31:48 +00:00
[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 11e97f2f80
)
This commit is contained in:
parent
a0ccc54e6d
commit
2eca5b465f
3 changed files with 11 additions and 2 deletions
|
@ -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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue