diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-09-29 11:59:50 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-09-29 11:59:50 (GMT) |
commit | 449b27179931aa570597556ed4865ac2f1f981c9 (patch) | |
tree | 1d490e256eb029d67e2cee1a2514a4633f5ca53f /Python/pylifecycle.c | |
parent | 3f7468507ae83d66cee059fb8e51692d8adb797b (diff) | |
download | cpython-449b27179931aa570597556ed4865ac2f1f981c9.zip cpython-449b27179931aa570597556ed4865ac2f1f981c9.tar.gz cpython-449b27179931aa570597556ed4865ac2f1f981c9.tar.bz2 |
Issue #18174: Explain why is_valid_fd() uses dup() instead of fstat()
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r-- | Python/pylifecycle.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 4f5efc9..857a543 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -972,6 +972,9 @@ is_valid_fd(int fd) if (fd < 0 || !_PyVerify_fd(fd)) return 0; _Py_BEGIN_SUPPRESS_IPH + /* Prefer dup() over fstat(). fstat() can require input/output whereas + dup() doesn't, there is a low risk of EMFILE/ENFILE at Python + startup. */ fd2 = dup(fd); if (fd2 >= 0) close(fd2); |