Commit ce9e3c3a authored by Gregory P. Smith's avatar Gregory P. Smith

Silence a -Wformat-extra-argument warning when compiling.

parent 6214d493
...@@ -167,13 +167,21 @@ weakref_repr(PyWeakReference *self) ...@@ -167,13 +167,21 @@ weakref_repr(PyWeakReference *self)
PyErr_Clear(); PyErr_Clear();
else if (PyUnicode_Check(nameobj)) else if (PyUnicode_Check(nameobj))
name = _PyUnicode_AsString(nameobj); name = _PyUnicode_AsString(nameobj);
PyOS_snprintf(buffer, sizeof(buffer), if (name != NULL) {
name ? "<weakref at %p; to '%.50s' at %p (%s)>" PyOS_snprintf(buffer, sizeof(buffer),
: "<weakref at %p; to '%.50s' at %p>", "<weakref at %p; to '%.50s' at %p (%s)>",
self, self,
Py_TYPE(PyWeakref_GET_OBJECT(self))->tp_name, Py_TYPE(PyWeakref_GET_OBJECT(self))->tp_name,
PyWeakref_GET_OBJECT(self), PyWeakref_GET_OBJECT(self),
name); 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); Py_XDECREF(nameobj);
} }
return PyUnicode_FromString(buffer); return PyUnicode_FromString(buffer);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment