summaryrefslogtreecommitdiffstats
path: root/Python/ast_opt.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/ast_opt.c')
-rw-r--r--Python/ast_opt.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/Python/ast_opt.c b/Python/ast_opt.c
index 967e75d..2911370 100644
--- a/Python/ast_opt.c
+++ b/Python/ast_opt.c
@@ -268,15 +268,8 @@ parse_literal(PyObject *fmt, Py_ssize_t *ppos, PyArena *arena)
PyObject *str = PyUnicode_Substring(fmt, start, pos);
/* str = str.replace('%%', '%') */
if (str && has_percents) {
- _Py_static_string(PyId_double_percent, "%%");
- _Py_static_string(PyId_percent, "%");
- PyObject *double_percent = _PyUnicode_FromId(&PyId_double_percent);
- PyObject *percent = _PyUnicode_FromId(&PyId_percent);
- if (!double_percent || !percent) {
- Py_DECREF(str);
- return NULL;
- }
- Py_SETREF(str, PyUnicode_Replace(str, double_percent, percent, -1));
+ Py_SETREF(str, PyUnicode_Replace(str, &_Py_STR(dbl_percent),
+ &_Py_STR(percent), -1));
}
if (!str) {
return NULL;