mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
bpo-35454: Fix miscellaneous minor issues in error handling. (#11077)
* bpo-35454: Fix miscellaneous minor issues in error handling. * Fix a null pointer dereference.
This commit is contained in:
parent
bb86bf4c4e
commit
8905fcc85a
9 changed files with 44 additions and 23 deletions
|
@ -103,15 +103,15 @@ namespace_repr(PyObject *ns)
|
|||
PyObject *value, *item;
|
||||
|
||||
value = PyDict_GetItem(d, key);
|
||||
assert(value != NULL);
|
||||
|
||||
item = PyUnicode_FromFormat("%S=%R", key, value);
|
||||
if (item == NULL) {
|
||||
loop_error = 1;
|
||||
}
|
||||
else {
|
||||
loop_error = PyList_Append(pairs, item);
|
||||
Py_DECREF(item);
|
||||
if (value != NULL) {
|
||||
item = PyUnicode_FromFormat("%S=%R", key, value);
|
||||
if (item == NULL) {
|
||||
loop_error = 1;
|
||||
}
|
||||
else {
|
||||
loop_error = PyList_Append(pairs, item);
|
||||
Py_DECREF(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue