def resolves_outside_root_or_cannot_stat(
    path: Path,
    root: Path,
    report: Optional[Report] = None,
) -> bool:
    """
    Returns whether the path is a symbolic link that points outside the
    root directory. Also returns True if we failed to resolve the path.
    """
    try:
        resolved_path = _cached_resolve(path)
    except OSError as e:
        if report:
            report.path_ignored(path, f"cannot be read because {e}")
        return True
    try:
        resolved_path.relative_to(root)
    except ValueError:
        if report:
            report.path_ignored(path, f"is a symbolic link that points outside {root}")
        return True
    return False

    Returns whether the path is a symbolic link that points outside the
    root directory. Also returns True if we failed to resolve the path.
    
src/black/files.py