diff options
author | Brett Cannon <brett@python.org> | 2012-08-24 17:05:09 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2012-08-24 17:05:09 (GMT) |
commit | 07c6e7168919c275e47fa35c741413270d3d80fd (patch) | |
tree | 5dd658c5cf3b17902ddaf1c9dcc0c7d34dfeb6a6 /Objects | |
parent | 491b1dc79efd4d3fc39b0ded2cd3fd746154b882 (diff) | |
download | cpython-07c6e7168919c275e47fa35c741413270d3d80fd.zip cpython-07c6e7168919c275e47fa35c741413270d3d80fd.tar.gz cpython-07c6e7168919c275e47fa35c741413270d3d80fd.tar.bz2 |
Issue #15778: Coerce ImportError.args to a string when it isn't
already one.
Patch by Dave Malcolm.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/exceptions.c | 2 |
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; } |