[Python-checkins] cpython (2.7): Silence a -Wformat-extra-argument warning when compiling.
gregory.p.smith
python-checkins at python.org
Sat Feb 2 01:15:55 CET 2013
http://hg.python.org/cpython/rev/59acde449f8d
changeset: 81893:59acde449f8d
branch: 2.7
parent: 81889:d64e0cf5f1a7
user: Gregory P. Smith <greg at krypto.org>
date: Fri Feb 01 16:13:27 2013 -0800
summary:
Silence a -Wformat-extra-argument warning when compiling.
files:
Objects/weakrefobject.c | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -167,13 +167,21 @@
PyErr_Clear();
else if (PyString_Check(nameobj))
name = PyString_AS_STRING(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 PyString_FromString(buffer);
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list