Fix case where PyErr::matches and PyErr::is_instance returned results inconsistent with PyErr::get_type.
PyErr::matches
PyErr::is_instance
PyErr::get_type