summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/moduleobject.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index 2be49fb..2973263 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -687,14 +687,11 @@ module_getattro(PyModuleObject *m, PyObject *name)
if (m->md_dict) {
_Py_IDENTIFIER(__name__);
mod_name = _PyDict_GetItemId(m->md_dict, &PyId___name__);
- if (mod_name) {
+ if (mod_name && PyUnicode_Check(mod_name)) {
PyErr_Format(PyExc_AttributeError,
"module '%U' has no attribute '%U'", mod_name, name);
return NULL;
}
- else if (PyErr_Occurred()) {
- PyErr_Clear();
- }
}
PyErr_Format(PyExc_AttributeError,
"module has no attribute '%U'", name);