Eryk Sun <eryk...@gmail.com> added the comment:

> First it seems the error is being raised incorrectly - winerror 2 is 
> for file not found, but it's being passed as errno 2. 

I think this only happens with open(). The _io module could use the CRT's 
_doserrno value to call PyErr_SetExcFromWindowsErrWithFilenameObject. We can 
rely on _doserrno if _wopen fails.

Otherwise this is the expected mapping from Windows ERROR_PATH_NOT_FOUND (3) or 
ERROR_FILENAME_EXCED_RANGE (206) to POSIX ENOENT (2). The Windows error in the 
case of path that's too long is not ERROR_FILE_NOT_FOUND (2).

----------
nosy: +eryksun

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37769>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to