summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/exceptions.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index b7e11f8..74bb262 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -679,7 +679,7 @@ ImportError_traverse(PyImportErrorObject *self, visitproc visit, void *arg)
static PyObject *
ImportError_str(PyImportErrorObject *self)
{
- if (self->msg) {
+ if (self->msg && PyUnicode_CheckExact(self->msg)) {
Py_INCREF(self->msg);
return self->msg;
}