Prevent infinite loop in pathlib.resolve() on Windows