Message81321
| Author |
loewis |
| Recipients |
amaury.forgeotdarc, kristjan.jonsson, loewis, mhammond, ocean-city |
| Date |
2009年02月06日.23:56:51 |
| SpamBayes Score |
4.070056e-09 |
| Marked as misclassified |
No |
| Message-id |
<1233964673.18.0.997263827668.issue4804@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I think the comment (an invalid fd would be a C program bug)
misrepresents the facts. Please don't check it in as-is. An invalid file
descriptor is *not* assertable. The authority on file descriptors, the
POSIX standard, specifies for, say, write(2)
[...] Otherwise, -1 shall be returned and errno set to indicate the error.
[...] [EBADF] The fildes argument is not a valid file descriptor open
for writing.
This is consistent throughout the entire API: the behavior for invalid
file descriptors is *not* undefined, and not even
implementation-defined. If the CRT would conform to the relevant,
long-existing specifications it tries to emulate, it would just set
errno to EBADF, and be done.
There should be a global declaration of _Py_verify_fd. I would also
suggest that it becomes a constant macro unless _MSC_VER is defined. |
|