-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
bpo-45919: Use WinAPI GetFileType() in is_valid_fd() #30082
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I got the same performance enhancement by measuring QueryPerformanceCounter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@vstinner, the original change was to use |
The out of date comment was not updated in the merge. |
https://bugs.python.org/issue45919