diff options
Diffstat (limited to 'Objects/namespaceobject.c')
-rw-r--r-- | Objects/namespaceobject.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Objects/namespaceobject.c b/Objects/namespaceobject.c index 2acf809..aba3ff7 100644 --- a/Objects/namespaceobject.c +++ b/Objects/namespaceobject.c @@ -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); |