Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
skip issubclass when not an exception
  • Loading branch information
iritkatriel committed Mar 7, 2023
commit a9094f9e6de93d4239a69cbb86fa26559ee52515
4 changes: 2 additions & 2 deletions Python/errors.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ _PyErr_SetObject(PyThreadState *tstate, PyObject *exception, PyObject *value)
Py_XINCREF(value);
/* Normalize the exception */
int is_subclass = 0;
if (value != NULL) {
if (value != NULL && PyExceptionInstance_Check(value)) {
is_subclass = PyObject_IsSubclass((PyObject*)Py_TYPE(value), exception);
Comment thread
iritkatriel marked this conversation as resolved.
Outdated
Comment thread
gvanrossum marked this conversation as resolved.
Outdated
if (is_subclass < 0) {
return;
Comment thread
iritkatriel marked this conversation as resolved.
}
}
if (value == NULL || !is_subclass) {
if (!is_subclass) {
/* We must normalize the value right now */
PyObject *fixed_value;

Expand Down