diff options
| author | Brett Cannon <brett@python.org> | 2012-08-24 13:05:09 -0400 |
|---|---|---|
| committer | Brett Cannon <brett@python.org> | 2012-08-24 13:05:09 -0400 |
| commit | 3e70ded9b93de73d379bd81596fa8dd9aa607c32 (patch) | |
| tree | 00ed9f5cd37561a9c79980996f963c35330d978a /Objects | |
| parent | b1f5bc4f1352288eedbb69b69c6835ea321fd5c3 (diff) | |
| download | cpython-3e70ded9b93de73d379bd81596fa8dd9aa607c32.tar.gz | |
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 b7e11f85bf..74bb26285e 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; } |
