aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-12-11 08:38:03 +0200
committerGitHub <noreply@github.com>2018-12-11 08:38:03 +0200
commit8905fcc85a6fc3ac394bc89b0bbf40897e9497a6 (patch)
tree5b7afcdceab6dae37e3db90f952c5c76fe46b5cf /Objects/namespaceobject.c
parentbpo-35444: Unify and optimize the helper for getting a builtin object. (GH-11... (diff)
downloadcpython-8905fcc85a6fc3ac394bc89b0bbf40897e9497a6.tar.gz
cpython-8905fcc85a6fc3ac394bc89b0bbf40897e9497a6.tar.bz2
cpython-8905fcc85a6fc3ac394bc89b0bbf40897e9497a6.zip
bpo-35454: Fix miscellaneous minor issues in error handling. (#11077)
* bpo-35454: Fix miscellaneous minor issues in error handling. * Fix a null pointer dereference.
Diffstat (limited to 'Objects/namespaceobject.c')
-rw-r--r--Objects/namespaceobject.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/Objects/namespaceobject.c b/Objects/namespaceobject.c
index 0b902693849..2acf809959d 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);
+ }
}
}