Skip to content

bpo-45919: Remove out of date comment #30090

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

Merged
merged 2 commits into from
Dec 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Python/pylifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -2168,13 +2168,15 @@ is_valid_fd(int fd)
some platforms.

fcntl(fd, F_GETFD) is even faster, because it only checks the process table.
It is preferred over dup() when available, since it cannot fail with the
"too many open files" error (EMFILE).

bpo-30225: On macOS Tiger, when stdout is redirected to a pipe and the other
side of the pipe is closed, dup(1) succeed, whereas fstat(1, &st) fails with
EBADF. FreeBSD has similar issue (bpo-32849).

Only use dup() on platforms where dup() is enough to detect invalid FD in
corner cases: on Linux and Windows (bpo-32849).
Only use dup() on Linux where dup() is enough to detect invalid FD
(bpo-32849).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the "fcntl(fd, F_GETFD) is even faster, because it only checks the process table" comment, you can add that it is preferred over dup() when avaialble, since it cannot fail with the "too many open files" error (EMFILE).

*/
if (fd < 0) {
return 0;
Expand Down