mirror of
https://github.com/python/cpython.git
synced 2025-09-11 11:17:16 +00:00
bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112)
This commit is contained in:
parent
a180b007d9
commit
a24107b04c
31 changed files with 538 additions and 242 deletions
|
@ -102,9 +102,9 @@ namespace_repr(PyObject *ns)
|
|||
if (PyUnicode_Check(key) && PyUnicode_GET_LENGTH(key) > 0) {
|
||||
PyObject *value, *item;
|
||||
|
||||
value = PyDict_GetItem(d, key);
|
||||
value = PyDict_GetItemWithError(d, key);
|
||||
if (value != NULL) {
|
||||
item = PyUnicode_FromFormat("%S=%R", key, value);
|
||||
item = PyUnicode_FromFormat("%U=%R", key, value);
|
||||
if (item == NULL) {
|
||||
loop_error = 1;
|
||||
}
|
||||
|
@ -113,6 +113,9 @@ namespace_repr(PyObject *ns)
|
|||
Py_DECREF(item);
|
||||
}
|
||||
}
|
||||
else if (PyErr_Occurred()) {
|
||||
loop_error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
Py_DECREF(key);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue