[issue42855] pathlib.exists on Windows raises an exception on URL like/bad input

Eryk Sun report at bugs.python.org
Thu Jan 7 12:30:44 EST 2021


Eryk Sun <eryksun at gmail.com> added the comment:

An alternative would be to add a "strict" parameter that defaults to False. In non-strict mode, map all OSError exceptions to a False return value. In strict mode, use _ignore_error(e) to determine whether to return False or propagate the exception. The question then is whether to add ERROR_INVALID_NAME (123) to _IGNORED_WINERRORS since the error means the name can never exist. On the other hand, ERROR_ACCESS_DENIED due to a permission error would be propagated in strict mode -- because the path's existence is unknown.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42855>
_______________________________________


More information about the Python-bugs-list mailing list