summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2013-02-02 00:14:00 (GMT)
committerGregory P. Smith <greg@krypto.org>2013-02-02 00:14:00 (GMT)
commitce9e3c3af9624fa5273b2e301043f3892135fb18 (patch)
tree611f03b5b482fccd79ff024da7eb138204474216 /Objects
parent6214d4937ce2fe9aead14ddb9d65a95fb68088ee (diff)
downloadcpython-ce9e3c3af9624fa5273b2e301043f3892135fb18.zip
cpython-ce9e3c3af9624fa5273b2e301043f3892135fb18.tar.gz
cpython-ce9e3c3af9624fa5273b2e301043f3892135fb18.tar.bz2
Silence a -Wformat-extra-argument warning when compiling.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/weakrefobject.c22
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);