[3.13] gh-153711: Avoid use of dup3 and pipe2 calls introduced in macOS 27 (#155211)
ned-deily <[email protected]> Wed, 05 Aug 2026 03:30:31 -0400 (EDT)
| Newsgroups | gmane.comp.python.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://github.com/python/cpython/commit/e86913423b4e1aa7b7ff8de3b0df9055d5117159 commit: e86913423b4e1aa7b7ff8de3b0df9055d5117159 branch: 3.13 author: Ned Deily <[email protected]> committer: ned-deily <[email protected]> date: 2026-08-05T03:30:17-04:00 summary: [3.13] gh-153711: Avoid use of dup3 and pipe2 calls introduced in macOS 27 (#155211) This prevents potential segfaults when builds are used on older systems and avoids adding new code for supporting weaklinking. files: A Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst M configure M configure.ac diff --git a/Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst b/Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst new file mode 100644 index 000000000000000..90804c179a4b4a4 --- /dev/null +++ b/Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst @@ -0,0 +1,3 @@ +On macOS, do not attempt to use the :manpage:`dup3(2)` and +:manpage:`pipe2(2)` system calls introduced in +macOS 27 to prevent problems when running on older systems. diff --git a/configure b/configure index c42bffecdcfcdd8..51e657ff0d61e31 100755 --- a/configure +++ b/configure @@ -19381,13 +19381,7 @@ fi # header definition prevents usage - autoconf doesn't use the headers), or # raise an error if used at runtime. Force these symbols off. if test "$ac_sys_system" != "iOS" ; then - ac_fn_c_check_func "$LINENO" "dup3" "ac_cv_func_dup3" -if test "x$ac_cv_func_dup3" = xyes -then : - printf "%s\n" "#define HAVE_DUP3 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy" + ac_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy" if test "x$ac_cv_func_getentropy" = xyes then : printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h @@ -19398,12 +19392,6 @@ if test "x$ac_cv_func_getgroups" = xyes then : printf "%s\n" "#define HAVE_GETGROUPS 1" >>confdefs.h -fi -ac_fn_c_check_func "$LINENO" "pipe2" "ac_cv_func_pipe2" -if test "x$ac_cv_func_pipe2" = xyes -then : - printf "%s\n" "#define HAVE_PIPE2 1" >>confdefs.h - fi ac_fn_c_check_func "$LINENO" "system" "ac_cv_func_system" if test "x$ac_cv_func_system" = xyes @@ -19412,6 +19400,24 @@ then : fi +fi +# In addition, macOS introduced dup3 and pipe2 in macOS 27, late in the +# lifetime of this version of Python. Rather than adding weaklinking +# support for them, just continue to ignore them. +if test "$ac_sys_system" != "iOS" -a "$ac_sys_system" != "Darwin"; then + ac_fn_c_check_func "$LINENO" "dup3" "ac_cv_func_dup3" +if test "x$ac_cv_func_dup3" = xyes +then : + printf "%s\n" "#define HAVE_DUP3 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "pipe2" "ac_cv_func_pipe2" +if test "x$ac_cv_func_pipe2" = xyes +then : + printf "%s\n" "#define HAVE_PIPE2 1" >>confdefs.h + +fi + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 diff --git a/configure.ac b/configure.ac index 047005fd7177b6f..f93a9f29b39aff8 100644 --- a/configure.ac +++ b/configure.ac @@ -5282,7 +5282,13 @@ fi # header definition prevents usage - autoconf doesn't use the headers), or # raise an error if used at runtime. Force these symbols off. if test "$ac_sys_system" != "iOS" ; then - AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system]) + AC_CHECK_FUNCS([getentropy getgroups system]) +fi +# In addition, macOS introduced dup3 and pipe2 in macOS 27, late in the +# lifetime of this version of Python. Rather than adding weaklinking +# support for them, just continue to ignore them. +if test "$ac_sys_system" != "iOS" -a "$ac_sys_system" != "Darwin"; then + AC_CHECK_FUNCS([dup3 pipe2]) fi AC_CHECK_DECL([dirfd], _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]