def safe_isclass(obj: object) -> bool:
    """Ignore any exception via isinstance on Python 3."""
    try:
        return inspect.isclass(obj)
    except Exception:
        return False
Ignore any exception via isinstance on Python 3.
src/_pytest/compat.py