commit | 449b27179931aa570597556ed4865ac2f1f981c9 | [log] [tgz] |
---|---|---|
author | Victor Stinner <victor.stinner@gmail.com> | Tue Sep 29 13:59:50 2015 +0200 |
committer | Victor Stinner <victor.stinner@gmail.com> | Tue Sep 29 13:59:50 2015 +0200 |
tree | 1d490e256eb029d67e2cee1a2514a4633f5ca53f | |
parent | 3f7468507ae83d66cee059fb8e51692d8adb797b [diff] [blame] |
Issue #18174: Explain why is_valid_fd() uses dup() instead of fstat()
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 @@ 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);