summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS.d/next/Library/2018-02-19-17-46-31.bpo-32859.kAT-Xp.rst2
-rw-r--r--Modules/posixmodule.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/Misc/NEWS.d/next/Library/2018-02-19-17-46-31.bpo-32859.kAT-Xp.rst b/Misc/NEWS.d/next/Library/2018-02-19-17-46-31.bpo-32859.kAT-Xp.rst
new file mode 100644
index 0000000..755bdc1
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2018-02-19-17-46-31.bpo-32859.kAT-Xp.rst
@@ -0,0 +1,2 @@
+In ``os.dup2``, don't check every call whether the ``dup3`` syscall exists
+or not.
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index d242df0..0bbf7c5 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -8016,7 +8016,7 @@ os_dup2_impl(PyObject *module, int fd, int fd2, int inheritable)
#if defined(HAVE_DUP3) && \
!(defined(HAVE_FCNTL_H) && defined(F_DUP2FD_CLOEXEC))
/* dup3() is available on Linux 2.6.27+ and glibc 2.9 */
- int dup3_works = -1;
+ static int dup3_works = -1;
#endif
if (fd < 0 || fd2 < 0) {