You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pathlib is_* functions do not fail in case of errno=EIO #160959
Pathlib functions do not fall with exception if they can not check. For example, .is_mount() will say False on mountpoint with failed FS. The most correct way - is to raise an Exception is check can not be done. EIO means "I don't know", not "this is not a mountpoint". The same with other is_* (like is_dir(), is_file() и is_symlink())
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
The same: mkdir(exist_ok=True) - will silently return on EIO. Any EIO must not be swallowed, as I think.
changed the title [-]Ptahlib function do not fail in case of errno=EIO[/-][+]Pathlib is_* functions do not fail in case of errno=EIO[/+]on Oct 30, 2026
Yes, it is inconsistent with pathlib's own previous behavior.
Up to 3.13, Path.exists()/is_*() suppressed only errors that genuinely mean
"no" (ENOENT, ENOTDIR, EBADF, ELOOP); EIO, EACCES etc. propagated. In 3.14
(gh-101357 / gh-118243) this was widened to all OSError as a side effect of
a Windows performance optimization. So the breaking change has already
happened; restoring the old behavior would fix a regression.
The principle: if the check could not be done, there is no correct boolean
answer, so raise. EIO means "I don't know", not "no". Returning False hides
real problems like a failing disk or a dead NFS/FUSE mount.
Proposal: restore the strict behavior by default. If that's not acceptable,
add a keyword-only strict= parameter (as eryksun suggested in gh-101357).
Yes, it is inconsistent with pathlib's own previous behavior.
I meant, is it inconsistent with existing behavior of other functions. What is preferrable is whether this changes with respect to os.path.is* functions, i.e. os.path.islink can raise EIO while Pathlib.islink cannot? what's important to me is that os.path* functions and pathlib do the same unless told otherwise.
I'm ok with a strict keyword though (we have some strict policy that was added in 3.15). However, we won't change 3.14 I believe. AFAICT, ismount() was not affected by that change and forwarded to os.path.ismount.
The documentation mentions this is an intentional change and consistent with the os.path.is* functions:
Changed in version 3.14: The methods given above now return False instead of raising any OSError exception from the operating system. In previous versions, some kinds of OSError exception are raised, and others suppressed. The new behaviour is consistent with os.path.exists(), os.path.isdir(), etc. Use stat() to retrieve the file status without suppressing exceptions.
Activity
[-]Ptahlib function do not fail in case of errno=EIO[/-][+]Pathlib is_* functions do not fail in case of errno=EIO[/+]picnixz commentedon Oct 30, 2026
This will be a breaking change. Is the behavior inconsistent with other functions or oa.path.* ones?
socketpair commentedon Oct 30, 2026
@picnixz
Yes, it is inconsistent with pathlib's own previous behavior.
Up to 3.13, Path.exists()/is_*() suppressed only errors that genuinely mean
"no" (ENOENT, ENOTDIR, EBADF, ELOOP); EIO, EACCES etc. propagated. In 3.14
(gh-101357 / gh-118243) this was widened to all OSError as a side effect of
a Windows performance optimization. So the breaking change has already
happened; restoring the old behavior would fix a regression.
The principle: if the check could not be done, there is no correct boolean
answer, so raise. EIO means "I don't know", not "no". Returning False hides
real problems like a failing disk or a dead NFS/FUSE mount.
Proposal: restore the strict behavior by default. If that's not acceptable,
add a keyword-only strict= parameter (as eryksun suggested in gh-101357).
picnixz commentedon Oct 30, 2026
I meant, is it inconsistent with existing behavior of other functions. What is preferrable is whether this changes with respect to
os.path.is*functions, i.e.os.path.islinkcan raise EIO whilePathlib.islinkcannot? what's important to me is thatos.path*functions andpathlibdo the same unless told otherwise.I'm ok with a
strictkeyword though (we have some strict policy that was added in 3.15). However, we won't change 3.14 I believe. AFAICT, ismount() was not affected by that change and forwarded toos.path.ismount.cc @zooba @barneygale @serhiy-storchaka @encukou
ronaldoussoren commentedon Oct 30, 2026
The documentation mentions this is an intentional change and consistent with the
os.path.is*functions: