mirror of
https://github.com/python/cpython.git
synced 2025-09-19 07:00:59 +00:00
bpo-36817: Fix reference leak for expr_text in f-string = parsing (GH-13249)
This commit is contained in:
parent
90fb04c1e2
commit
5833e94d86
1 changed files with 7 additions and 2 deletions
|
@ -5228,11 +5228,16 @@ fstring_find_expr(const char **str, const char *end, int raw, int recurse_lvl,
|
||||||
|
|
||||||
}
|
}
|
||||||
if (equal_flag) {
|
if (equal_flag) {
|
||||||
Py_ssize_t len = expr_text_end-expr_start;
|
Py_ssize_t len = expr_text_end - expr_start;
|
||||||
expr_text = PyUnicode_FromStringAndSize(expr_start, len);
|
expr_text = PyUnicode_FromStringAndSize(expr_start, len);
|
||||||
if (!expr_text)
|
if (!expr_text) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
if (PyArena_AddPyObject(c->c_arena, expr_text) < 0) {
|
||||||
|
Py_DECREF(expr_text);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Check for the format spec, if present. */
|
/* Check for the format spec, if present. */
|
||||||
if (*str >= end)
|
if (*str >= end)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue