Skip to content

Commit

Permalink
PyErr_NormalizeException(): If the exception's type is a class and the
Browse files Browse the repository at this point in the history
instance's class is a subclass of this, then use the instance's class
as the exception type.
  • Loading branch information
warsaw committed Sep 30, 1997
1 parent 22ecb71 commit 3a74993
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Python/errors.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3a74993

Please sign in to comment.