summaryrefslogtreecommitdiff
path: root/Objects
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-12-10 23:05:13 -0800
committerGitHub <noreply@github.com>2018-12-10 23:05:13 -0800
commit62674f3a36ec55f86a5f20ee028a37fbd549bd6c (patch)
treee0e54395611c4a6eca057ea673c2d515fe45cd3b /Objects
parent3b9a0186c44d0c3e477c38fdc00203ec99aec912 (diff)
downloadcpython-git-62674f3a36ec55f86a5f20ee028a37fbd549bd6c.tar.gz
bpo-35454: Fix miscellaneous minor issues in error handling. (GH-11077)
* bpo-35454: Fix miscellaneous minor issues in error handling. * Fix a null pointer dereference. (cherry picked from commit 8905fcc85a6fc3ac394bc89b0bbf40897e9497a6) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Objects')
-rw-r--r--Objects/namespaceobject.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/Objects/namespaceobject.c b/Objects/namespaceobject.c
index 7de102eb06..c2f9d30d29 100644
--- a/Objects/namespaceobject.c
+++ b/Objects/namespaceobject.c
@@ -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);
+ }
}
}