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.
This commit is contained in:
Barry Warsaw 1997-09-30 15:00:18 +00:00
parent 22ecb71078
commit 3a74993118
1 changed files with 8 additions and 0 deletions

View File

@ -206,6 +206,14 @@ PyErr_NormalizeException(exc, val, tb)
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;