mirror of https://github.com/python/cpython.git
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:
parent
22ecb71078
commit
3a74993118
|
@ -206,6 +206,14 @@ PyErr_NormalizeException(exc, val, tb)
|
||||||
Py_DECREF(value);
|
Py_DECREF(value);
|
||||||
value = res;
|
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;
|
*exc = type;
|
||||||
*val = value;
|
*val = value;
|
||||||
|
|
Loading…
Reference in New Issue