diff options
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; } |