Description
Feature or enhancement
Proposal:
Currently, a ValueError
is raised by the path_t
converter if the input path is too long or if there are embedded null bytes. For any C code that is using this converter, such as os.stat
, this actually makes os.stat
raise a ValueError instead of an OSError in this case.
EDIT: Remove paragraph on NUL bytes. For NUL bytes, the converter must anyway raise ValueError
. I fixed linecache in #122176 for that.
See #122170 (comment) for another issue (only on Windows though I don't know why since Linux may also have too long paths in general).
So, what I suggest is to raise OSError, or have a way to only disable ValueError that would not make stat(2)
fail (i.e., keep ValueError for NUL bytes but not for long paths). I don't know which is the best but I'd prefer just ignoring long paths in path_t
converter itself.