bpo-45919: Use WinAPI GetFileType() in is_valid_fd()#30082
bpo-45919: Use WinAPI GetFileType() in is_valid_fd()#30082corona10 merged 3 commits intopython:mainfrom
Conversation
I got the same performance enhancement by measuring QueryPerformanceCounter. |
vstinner
left a comment
There was a problem hiding this comment.
LGTM. I just proposed a minor coding style change (it's up to you).
|
The int res;
_Py_BEGIN_SUPPRESS_IPH
res = fcntl(fd, F_GETFD);
_Py_END_SUPPRESS_IPH
return res >= 0;becomes simply: return fcntl(fd, F_GETFD) >= 0; |
|
The comment that discusses the function should be updated to remove Windows from the platforms that use |
|
Was it verified that |
See the comment: In case of doubt, I prefer to continue using fcntl() which always works. On BSD systems, dup() seems to implement less checks. |
@vstinner, the original change was to use |
The out of date comment was not updated in the merge. |
https://bugs.python.org/issue45919