diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-27 13:44:33 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-27 13:44:33 (GMT) |
commit | 726fc139a5f40d81a0013c856be1283da08de4a0 (patch) | |
tree | 7a7fe3b19e13842df5b5d45a8567fbfb5e7bbd75 /Python/ast.c | |
parent | bdb908ea5466bfa09869fd2e1e7f3b17fe0fb2ea (diff) | |
parent | 191321d11bc7e064e1a07830a43fa600de310e1b (diff) | |
download | cpython-726fc139a5f40d81a0013c856be1283da08de4a0.zip cpython-726fc139a5f40d81a0013c856be1283da08de4a0.tar.gz cpython-726fc139a5f40d81a0013c856be1283da08de4a0.tar.bz2 |
Issue #20440: More use of Py_SETREF.
This patch is manually crafted and contains changes that couldn't be handled
automatically.
Diffstat (limited to 'Python/ast.c')
-rw-r--r-- | Python/ast.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/Python/ast.c b/Python/ast.c index 328ee5d..33f2597 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -4496,8 +4496,7 @@ fstring_find_literal_and_expr(PyObject *str, Py_ssize_t *ofs, int recurse_lvl, return 0; error: - Py_XDECREF(*literal); - *literal = NULL; + Py_CLEAR(*literal); return -1; } @@ -4692,11 +4691,8 @@ FstringParser_ConcatAndDel(FstringParser *state, PyObject *str) state->last_str = str; } else { /* Concatenate this with the previous string. */ - PyObject *temp = PyUnicode_Concat(state->last_str, str); - Py_DECREF(state->last_str); - Py_DECREF(str); - state->last_str = temp; - if (!temp) + PyUnicode_AppendAndDel(&state->last_str, str); + if (!state->last_str) return -1; } FstringParser_check_invariants(state); |