bpo-27729: Give a better error msg when a file path is too long on Windows
This commit is contained in:
parent
80d827c3cb
commit
48d7a3e7e3
|
@ -0,0 +1 @@
|
|||
Give a better error message when a file path is too long on Windows.
|
|
@ -700,7 +700,11 @@ PyErr_SetFromErrnoWithFilenameObjects(PyObject *exc, PyObject *filenameObject, P
|
|||
table, we use it, otherwise we assume it really _is_
|
||||
a Win32 error code
|
||||
*/
|
||||
if (i > 0 && i < _sys_nerr) {
|
||||
if (i == ENOENT && GetLastError() == ERROR_PATH_NOT_FOUND) {
|
||||
message = PyUnicode_FromString("No such path or path exceeds "
|
||||
"maximum allowed length");
|
||||
}
|
||||
else if (i > 0 && i < _sys_nerr) {
|
||||
message = PyUnicode_FromString(_sys_errlist[i]);
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue