diff options
author | Gregory P. Smith <greg@krypto.org> | 2013-02-02 00:14:00 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2013-02-02 00:14:00 (GMT) |
commit | ce9e3c3af9624fa5273b2e301043f3892135fb18 (patch) | |
tree | 611f03b5b482fccd79ff024da7eb138204474216 | |
parent | 6214d4937ce2fe9aead14ddb9d65a95fb68088ee (diff) | |
download | cpython-ce9e3c3af9624fa5273b2e301043f3892135fb18.zip cpython-ce9e3c3af9624fa5273b2e301043f3892135fb18.tar.gz cpython-ce9e3c3af9624fa5273b2e301043f3892135fb18.tar.bz2 |
Silence a -Wformat-extra-argument warning when compiling.
-rw-r--r-- | Objects/weakrefobject.c | 22 |
1 files 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 ? "<weakref at %p; to '%.50s' at %p (%s)>" - : "<weakref at %p; to '%.50s' at %p>", - self, - Py_TYPE(PyWeakref_GET_OBJECT(self))->tp_name, - PyWeakref_GET_OBJECT(self), - name); + if (name != NULL) { + PyOS_snprintf(buffer, sizeof(buffer), + "<weakref at %p; to '%.50s' at %p (%s)>", + self, + Py_TYPE(PyWeakref_GET_OBJECT(self))->tp_name, + PyWeakref_GET_OBJECT(self), + name); + } + else { + PyOS_snprintf(buffer, sizeof(buffer), + "<weakref at %p; to '%.50s' at %p>", + self, + Py_TYPE(PyWeakref_GET_OBJECT(self))->tp_name, + PyWeakref_GET_OBJECT(self)); + } Py_XDECREF(nameobj); } return PyUnicode_FromString(buffer); |