Mercurial > cpython-lru_cache-weakref
diff Python/errors.c @ 6358:9e82dd76288e legacy-trunk
PyErr_NormalizeException(): If the exception's type is a class and the
instance's class is a subclass of this, then use the instance's class
as the exception type.
| author | Barry Warsaw <barry@python.org> |
|---|---|
| date | Tue, 30 Sep 1997 15:00:18 +0000 |
| parents | b7f0b98f5325 |
| children | 4cb223f29337 |
line wrap: on
line diff
--- a/Python/errors.c Mon Sep 29 23:40:07 1997 +0000 +++ b/Python/errors.c Tue Sep 30 15:00:18 1997 +0000 @@ -206,6 +206,14 @@ Py_DECREF(value); value = res; } + /* if the class of the instance doesn't exactly match the + class of the type, believe the instance + */ + else if (inclass != type) { + Py_DECREF(type); + type = inclass; + Py_INCREF(type); + } } *exc = type; *val = value;
