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

The EINVAL error in Windows also needs improvement, but I don't what can be 
done after the fact. If there's a trailing slash when opening or creating a 
regular file, the NtCreateFile system call returns STATUS_OBJECT_INVALID_NAME. 
The Windows API maps this to ERROR_INVALID_NAME (123), which the CRT in turn 
maps to EINVAL (22). This error is too generic to handle. Even if the name ends 
in a slash, the error could be due to some other invalid character in the path 
(e.g. a common mistake is a '\t' or '\n' in a string literal). 

The problem could be addressed beforehand in shutil.copy by manually raising an 
exception if isdir() is false and the name has a trailing slash.

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

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

Reply via email to