Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Open
Description
Bug report
Bug description:
importosos.path.realpath("\x00")# raises unexpected ValueError
TheValueError is initially raised byos.lstat.
This behavior is inconsistent with other path operations catching theValueError raised byos.lstat:os.path.lexsists:https://github.com/python/cpython/blob/main/Lib/genericpath.py#L30os.path.exists:https://github.com/python/cpython/blob/main/Lib/genericpath.py#L20os.path.islink:https://github.com/python/cpython/blob/main/Lib/genericpath.py#L64os.path.ismount:https://github.com/python/cpython/blob/main/Lib/posixpath.py#L197os.path.ismount:https://github.com/python/cpython/blob/main/Lib/posixpath.py#L213
CPython versions tested on:
3.10, CPython main branch
Operating systems tested on:
Linux
Linked PRs
- gh-117596: Fix realpath ValueError on null byte #117573
- gh-117596: Add more tests for os.path with invalid paths #134189
- [3.14] gh-117596: Add more tests for os.path with invalid paths (GH-134189) #134265
- [3.13] gh-117596: Add more tests for os.path with invalid paths (GH-134189) #134266
- gh-117596: Handle more possible Exceptions explicitly #142415