mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Issue #13350: Replace most usages of PyUnicode_Format by PyUnicode_FromFormat.
This commit is contained in:
parent
08ad2fbc7f
commit
864741b2c7
7 changed files with 13 additions and 107 deletions
|
|
@ -217,8 +217,6 @@ PyObject* pysqlite_cache_display(pysqlite_Cache* self, PyObject* args)
|
|||
pysqlite_Node* ptr;
|
||||
PyObject* prevkey;
|
||||
PyObject* nextkey;
|
||||
PyObject* fmt_args;
|
||||
PyObject* template;
|
||||
PyObject* display_str;
|
||||
|
||||
ptr = self->first;
|
||||
|
|
@ -229,36 +227,21 @@ PyObject* pysqlite_cache_display(pysqlite_Cache* self, PyObject* args)
|
|||
} else {
|
||||
prevkey = Py_None;
|
||||
}
|
||||
Py_INCREF(prevkey);
|
||||
|
||||
if (ptr->next) {
|
||||
nextkey = ptr->next->key;
|
||||
} else {
|
||||
nextkey = Py_None;
|
||||
}
|
||||
Py_INCREF(nextkey);
|
||||
|
||||
fmt_args = Py_BuildValue("OOO", prevkey, ptr->key, nextkey);
|
||||
if (!fmt_args) {
|
||||
return NULL;
|
||||
}
|
||||
template = PyUnicode_FromString("%s <- %s ->%s\n");
|
||||
if (!template) {
|
||||
Py_DECREF(fmt_args);
|
||||
return NULL;
|
||||
}
|
||||
display_str = PyUnicode_Format(template, fmt_args);
|
||||
Py_DECREF(template);
|
||||
Py_DECREF(fmt_args);
|
||||
display_str = PyUnicode_FromFormat("%S <- %S -> %S\n",
|
||||
prevkey, ptr->key, nextkey);
|
||||
if (!display_str) {
|
||||
return NULL;
|
||||
}
|
||||
PyObject_Print(display_str, stdout, Py_PRINT_RAW);
|
||||
Py_DECREF(display_str);
|
||||
|
||||
Py_DECREF(prevkey);
|
||||
Py_DECREF(nextkey);
|
||||
|
||||
ptr = ptr->next;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue