Bug report
Bug description:
In configparser.RawConfigParser.read, when open() raises OSError, the file is skipped. Note that the OSError guard also includes the parsing phase and not just the call to open().
However, open() can raise a ValueError in the following cases:
- On Linux: The file has embedded NUL bytes.
- On Linux: The file has surrogate codes. On Windows, this raises an OSError instead.
Note that there is a test for checking when a file cannot be read assuming it has been opened. In particular, to retain compatibility, we should only skip the file if we cannot open it in the first place. Any issue during the parsing (such as an encoding or decoding error) should be propagated (but an OSError during the parsing should be suppressed as it is currently the case).
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
Bug report
Bug description:
In
configparser.RawConfigParser.read, whenopen()raisesOSError, the file is skipped. Note that theOSErrorguard also includes the parsing phase and not just the call toopen().However,
open()can raise a ValueError in the following cases:Note that there is a test for checking when a file cannot be read assuming it has been opened. In particular, to retain compatibility, we should only skip the file if we cannot open it in the first place. Any issue during the parsing (such as an encoding or decoding error) should be propagated (but an OSError during the parsing should be suppressed as it is currently the case).CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
ValueErrorinconfigparser.RawConfigParser.read[not ready for review] #122455