from typing import Callable
from typing import Any
import errno


def until_not_interrupted(f: Callable[..., Any], *args: Any, **kw: Any) -> Any:
    """
    Retry until *f* succeeds or an exception that isn't caused by EINTR occurs.

    :param f: A callable like a function.
    :param *args: Positional arguments for *f*.
    :param **kw: Keyword arguments for *f*.
    """
    while True:
        try:
            return f(*args, **kw)
        except OSError as e:
            if e.args[0] == errno.EINTR:
                continue
            raise