summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2022-07-31 15:39:41 (GMT)
committerGitHub <noreply@github.com>2022-07-31 15:39:41 (GMT)
commitdb13c0c1b8bc8c15d920a94ca008aabea4037697 (patch)
tree88b24924603fcffab9c1be7005c4622ba67e7a14 /Modules/posixmodule.c
parentc7ac8b65884a79e6a976811bca10527613b1396a (diff)
downloadcpython-db13c0c1b8bc8c15d920a94ca008aabea4037697.zip
cpython-db13c0c1b8bc8c15d920a94ca008aabea4037697.tar.gz
cpython-db13c0c1b8bc8c15d920a94ca008aabea4037697.tar.bz2
[3.11] gh-95174: Handle missing dup() and constants in WASI (GH-95229) (GH-95272)
Co-authored-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index f97013f..3780325 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -9346,7 +9346,9 @@ os_dup_impl(PyObject *module, int fd)
return _Py_dup(fd);
}
-
+// dup2() is either provided by libc or dup2.c with AC_REPLACE_FUNCS().
+// dup2.c provides working dup2() if and only if F_DUPFD is available.
+#if (defined(HAVE_DUP3) || defined(F_DUPFD) || defined(MS_WINDOWS))
/*[clinic input]
os.dup2 -> int
fd: int
@@ -9446,6 +9448,7 @@ os_dup2_impl(PyObject *module, int fd, int fd2, int inheritable)
return res;
}
+#endif
#ifdef HAVE_LOCKF