diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2011-11-06 14:10:48 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2011-11-06 14:10:48 (GMT) |
commit | 864741b2c7aaabda736f917694a1d3b26700e8e3 (patch) | |
tree | 8a79396976bd3f512eec73f88abfb60ca787377e /Modules/_sqlite/cache.c | |
parent | 08ad2fbc7f7abb687327b22eb7f65ac388742ab9 (diff) | |
download | cpython-864741b2c7aaabda736f917694a1d3b26700e8e3.zip cpython-864741b2c7aaabda736f917694a1d3b26700e8e3.tar.gz cpython-864741b2c7aaabda736f917694a1d3b26700e8e3.tar.bz2 |
Issue #13350: Replace most usages of PyUnicode_Format by PyUnicode_FromFormat.
Diffstat (limited to 'Modules/_sqlite/cache.c')
-rw-r--r-- | Modules/_sqlite/cache.c | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/Modules/_sqlite/cache.c b/Modules/_sqlite/cache.c index 735a242..3693363 100644 --- a/Modules/_sqlite/cache.c +++ b/Modules/_sqlite/cache.c @@ -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; } |