From ce9e3c3af9624fa5273b2e301043f3892135fb18 Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Fri, 1 Feb 2013 16:14:00 -0800 Subject: Silence a -Wformat-extra-argument warning when compiling. --- Objects/weakrefobject.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c index 8d571e6..417f075 100644 --- a/Objects/weakrefobject.c +++ b/Objects/weakrefobject.c @@ -167,13 +167,21 @@ weakref_repr(PyWeakReference *self) PyErr_Clear(); else if (PyUnicode_Check(nameobj)) name = _PyUnicode_AsString(nameobj); - PyOS_snprintf(buffer, sizeof(buffer), - name ? "" - : "", - self, - Py_TYPE(PyWeakref_GET_OBJECT(self))->tp_name, - PyWeakref_GET_OBJECT(self), - name); + if (name != NULL) { + PyOS_snprintf(buffer, sizeof(buffer), + "", + self, + Py_TYPE(PyWeakref_GET_OBJECT(self))->tp_name, + PyWeakref_GET_OBJECT(self), + name); + } + else { + PyOS_snprintf(buffer, sizeof(buffer), + "", + self, + Py_TYPE(PyWeakref_GET_OBJECT(self))->tp_name, + PyWeakref_GET_OBJECT(self)); + } Py_XDECREF(nameobj); } return PyUnicode_FromString(buffer); -- cgit v0.12