mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Issue #8914: fix various warnings from the Clang static analyzer v254.
This commit is contained in:
parent
79da6b7075
commit
b94767ff44
36 changed files with 69 additions and 84 deletions
|
@ -168,13 +168,20 @@ 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)
|
||||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue