This commit is contained in:
Ivan Pozdeev 2026-09-17 04:47:16 +03:00
commit 36b89575a5
99 changed files with 6994 additions and 50 deletions

View File

@ -9,6 +9,12 @@ inputs:
runs: runs:
using: composite using: composite
steps: steps:
- shell: bash
run: |
#envvars
export PYENV_ROOT="$GITHUB_WORKSPACE"
echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV
echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
# The two OSes differ only in this step. # The two OSes differ only in this step.
- if: runner.os == 'macOS' - if: runner.os == 'macOS'
shell: bash shell: bash
@ -19,15 +25,7 @@ runs:
shell: bash shell: bash
run: | run: |
#prerequisites #prerequisites
sudo apt-get update -q; sudo apt install -yq make build-essential libssl-dev zlib1g-dev \ pyenv install-prerequisites
libbz2-dev libreadline-dev libsqlite3-dev curl \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
- shell: bash
run: |
#envvars
export PYENV_ROOT="$GITHUB_WORKSPACE"
echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV
echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
- shell: bash - shell: bash
run: | run: |
#build #build

View File

@ -96,6 +96,7 @@ jobs:
- macos-15-intel - macos-15-intel
- macos-26 - macos-26
- macos-26-intel - macos-26-intel
- xcode-27
exclude: ${{fromJson(needs.discover_modified_scripts.outputs.versions_macos_build_exclude)}} exclude: ${{fromJson(needs.discover_modified_scripts.outputs.versions_macos_build_exclude)}}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
@ -164,6 +165,7 @@ jobs:
- macos-15-intel - macos-15-intel
- macos-26 - macos-26
- macos-26-intel - macos-26-intel
- xcode-27
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v7
@ -220,10 +222,7 @@ jobs:
echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
- run: | - run: |
#prerequisites #prerequisites
sudo apt-get update -q; sudo apt-get install -yq make build-essential \ pyenv install-prerequisites
libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \
curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev
if [[ "${{ matrix.python-version }}" =~ pypy.*-(src|dev) ]]; then if [[ "${{ matrix.python-version }}" =~ pypy.*-(src|dev) ]]; then
export PYENV_BOOTSTRAP_VERSION=pypy2.7-7 export PYENV_BOOTSTRAP_VERSION=pypy2.7-7
echo "PYENV_BOOTSTRAP_VERSION=$PYENV_BOOTSTRAP_VERSION" >> $GITHUB_ENV echo "PYENV_BOOTSTRAP_VERSION=$PYENV_BOOTSTRAP_VERSION" >> $GITHUB_ENV
@ -283,10 +282,7 @@ jobs:
echo "_PYTHON_BUILD_FORCE_SKIP_XZ=1" >> $GITHUB_ENV echo "_PYTHON_BUILD_FORCE_SKIP_XZ=1" >> $GITHUB_ENV
- run: | - run: |
#prerequisites #prerequisites
sudo apt-get update -q; sudo apt-get install -yq make build-essential \ pyenv install-prerequisites
libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \
curl libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev
- run: | - run: |
#build #build
pyenv --debug install ${{ matrix.python-version }} && rc=$? || rc=$? pyenv --debug install ${{ matrix.python-version }} && rc=$? || rc=$?

70
.github/workflows/publish_binary.yml vendored Normal file
View File

@ -0,0 +1,70 @@
name: Publish a binary package
on:
workflow_dispatch:
inputs:
version:
description: A CPython version accepted by `pyenv install`
required: true
type: string
permissions:
contents: read
jobs:
publish_ubuntu:
runs-on: ubuntu-24.04
env:
PYENV_ROOT: ${{ github.workspace }}
VERSION: ${{ inputs.version }}
steps:
- uses: actions/checkout@v7
- name: Install build prerequisites
run: ./bin/pyenv install-prerequisites
- name: Build package
env:
PYTHON_CONFIGURE_OPTS: --enable-optimizations
run: |
VERSION="${VERSION%%:*}"
entry="$(./bin/pyenv binary package-name "$VERSION")"
echo "entry=$entry" >> "$GITHUB_ENV"
mkdir dist
cd dist
"$GITHUB_WORKSPACE/bin/pyenv" binary package --verbose \
"$VERSION:$entry" \
--archive-base-url https://pyenv.github.io/pythons/binaries
- name: Generate GitHub token
uses: actions/create-github-app-token@v3
id: generate-token
with:
app-id: ${{ vars.PYENV_BOT_APP_ID }}
private-key: ${{ secrets.PYENV_BOT_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: pyenv.github.io
permission-contents: write
permission-pull-requests: write
- uses: actions/checkout@v7
with:
repository: pyenv/pyenv.github.io
token: ${{ steps.generate-token.outputs.token }}
path: site
- name: Update downloads
run: |
mkdir -p site/pythons/binaries
cp "dist/$entry.tar.xz" "dist/$entry.meta" "dist/$entry" \
site/pythons/binaries/
cd site/pythons
./update.sh
- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
with:
path: site
branch: auto_add_binary/${{ env.entry }}
title: Add CPython ${{ env.entry }}
commit-message: Add CPython ${{ env.entry }}
body: |
Built from pyenv/pyenv@${{ github.sha }} with profile-guided optimization enabled.
Part of pyenv/pyenv#2334.
token: ${{ steps.generate-token.outputs.token }}

View File

@ -10,11 +10,14 @@ TEST_PYTHON_BUILD_DOCKER_TARGETS = $(foreach bash,$(TEST_BASH_VERSIONS),$(addsuf
TEST_BINARY_DOCKER_PREFIX = test-binary-docker TEST_BINARY_DOCKER_PREFIX = test-binary-docker
TEST_BINARY_DOCKER_TARGETS = $(foreach bash,$(TEST_BASH_VERSIONS),$(addsuffix -$(bash),$(TEST_BINARY_DOCKER_PREFIX)) $(addsuffix -gnu-$(bash),$(TEST_BINARY_DOCKER_PREFIX))) TEST_BINARY_DOCKER_TARGETS = $(foreach bash,$(TEST_BASH_VERSIONS),$(addsuffix -$(bash),$(TEST_BINARY_DOCKER_PREFIX)) $(addsuffix -gnu-$(bash),$(TEST_BINARY_DOCKER_PREFIX)))
TEST_LINK_DOCKER_PREFIX = test-link-docker
TEST_LINK_DOCKER_TARGETS = $(foreach bash,$(TEST_BASH_VERSIONS),$(addsuffix -$(bash),$(TEST_LINK_DOCKER_PREFIX)) $(addsuffix -gnu-$(bash),$(TEST_LINK_DOCKER_PREFIX)))
TEST_BATS_IMAGE_PREFIX = test-pyenv-docker-image TEST_BATS_IMAGE_PREFIX = test-pyenv-docker-image
TEST_BATS_IMAGE_TARGETS = $(foreach bash,$(TEST_BASH_VERSIONS),$(addsuffix -$(bash),$(TEST_BATS_IMAGE_PREFIX)) $(addsuffix -gnu-$(bash),$(TEST_BATS_IMAGE_PREFIX))) TEST_BATS_IMAGE_TARGETS = $(foreach bash,$(TEST_BASH_VERSIONS),$(addsuffix -$(bash),$(TEST_BATS_IMAGE_PREFIX)) $(addsuffix -gnu-$(bash),$(TEST_BATS_IMAGE_PREFIX)))
.PHONY: test-docker .PHONY: test-docker
test-docker: $(TEST_UNIT_DOCKER_PREFIX) $(TEST_PYTHON_BUILD_DOCKER_PREFIX) $(TEST_BINARY_DOCKER_PREFIX) test-docker: $(TEST_UNIT_DOCKER_PREFIX) $(TEST_PYTHON_BUILD_DOCKER_PREFIX) $(TEST_BINARY_DOCKER_PREFIX) $(TEST_LINK_DOCKER_PREFIX)
.PHONY: $(TEST_UNIT_DOCKER_PREFIX) .PHONY: $(TEST_UNIT_DOCKER_PREFIX)
$(TEST_UNIT_DOCKER_PREFIX): $(TEST_UNIT_DOCKER_TARGETS) $(TEST_UNIT_DOCKER_PREFIX): $(TEST_UNIT_DOCKER_TARGETS)
@ -88,6 +91,29 @@ $(TEST_BINARY_DOCKER_TARGETS): $(TEST_BINARY_DOCKER_PREFIX)-% : $(TEST_BATS_IMAG
bats $${CI:+-F "/code/test/libexec/bats-format-tap-suite"} \ bats $${CI:+-F "/code/test/libexec/bats-format-tap-suite"} \
$${BATS_TEST_FILTER:+--filter "$${BATS_TEST_FILTER}"} plugins/pyenv-binary/test/$${BATS_FILE_FILTER} $${BATS_TEST_FILTER:+--filter "$${BATS_TEST_FILTER}"} plugins/pyenv-binary/test/$${BATS_FILE_FILTER}
.PHONY: $(TEST_LINK_DOCKER_PREFIX)
$(TEST_LINK_DOCKER_PREFIX): $(TEST_LINK_DOCKER_TARGETS)
.PHONY: $(TEST_LINK_DOCKER_TARGETS)
$(TEST_LINK_DOCKER_TARGETS): DOCKER_IMAGE = $(TEST_BATS_IMAGE_PREFIX)
$(TEST_LINK_DOCKER_TARGETS): GNU = $(if $(findstring -gnu-,$@),True,False)
$(TEST_LINK_DOCKER_TARGETS): BASH = $(filter $(TEST_BASH_VERSIONS),$(subst -, ,$@))
$(TEST_LINK_DOCKER_TARGETS): DOCKER_TAG = bash-$(BASH)-gnu-$(GNU)
$(TEST_LINK_DOCKER_TARGETS): INTERACTIVE = $(if $(findstring true,$(CI)),,-ti)
$(TEST_LINK_DOCKER_TARGETS): $(TEST_LINK_DOCKER_PREFIX)-% : $(TEST_BATS_IMAGE_PREFIX)-%
$(info Running test with docker image '$(DOCKER_IMAGE):$(DOCKER_TAG)')
docker run \
--init \
-v $(PWD):/code:ro \
-v /etc/passwd:/etc/passwd:ro \
-v /etc/group:/etc/group:ro \
-u "$$(id -u $$(whoami)):$$(id -g $$(whoami))" \
$${CI+-e CI="$${CI}"} \
$(INTERACTIVE) \
$(DOCKER_IMAGE):$(DOCKER_TAG) \
bats $${CI:+-F "/code/test/libexec/bats-format-tap-suite"} \
$${BATS_TEST_FILTER:+--filter "$${BATS_TEST_FILTER}"} plugins/pyenv-link/test/$${BATS_FILE_FILTER}
# Build all images needed for bats under docker # Build all images needed for bats under docker
.PHONY: $(TEST_BATS_IMAGE_PREFIX) .PHONY: $(TEST_BATS_IMAGE_PREFIX)
$(TEST_BATS_IMAGE_PREFIX): $(TEST_BATS_IMAGE_TARGETS) $(TEST_BATS_IMAGE_PREFIX): $(TEST_BATS_IMAGE_TARGETS)
@ -110,13 +136,13 @@ $(TEST_BATS_IMAGE_TARGETS):
./ ; \ ./ ; \
fi fi
.PHONY: test test-unit test-python-build test-binary .PHONY: test test-unit test-python-build test-binary test-link
# Do not pass in user flags to build tests. # Do not pass in user flags to build tests.
unexport PYTHON_CFLAGS unexport PYTHON_CFLAGS
unexport PYTHON_CONFIGURE_OPTS unexport PYTHON_CONFIGURE_OPTS
test: test-unit test-python-build test-binary test: test-unit test-python-build test-binary test-link
test-unit: bats test-unit: bats
PATH="./bats/bin:$$PATH" test/run PATH="./bats/bin:$$PATH" test/run
@ -129,6 +155,10 @@ test-binary: bats
cd plugins/pyenv-binary && $(PWD)/bats/bin/bats $${CI:+-F "$(PWD)/test/libexec/bats-format-tap-suite"} \ cd plugins/pyenv-binary && $(PWD)/bats/bin/bats $${CI:+-F "$(PWD)/test/libexec/bats-format-tap-suite"} \
$${BATS_TEST_FILTER:+--filter "$${BATS_TEST_FILTER}"} test/$${BATS_FILE_FILTER} $${BATS_TEST_FILTER:+--filter "$${BATS_TEST_FILTER}"} test/$${BATS_FILE_FILTER}
test-link: bats
cd plugins/pyenv-link && $(PWD)/bats/bin/bats $${CI:+-F "$(PWD)/test/libexec/bats-format-tap-suite"} \
$${BATS_TEST_FILTER:+--filter "$${BATS_TEST_FILTER}"} test/$${BATS_FILE_FILTER}
.SECONDARY: bats-$(TEST_BATS_VERSION) .SECONDARY: bats-$(TEST_BATS_VERSION)
bats-$(TEST_BATS_VERSION): bats-$(TEST_BATS_VERSION):
git clone --depth 1 --branch $(TEST_BATS_VERSION) https://github.com/bats-core/bats-core.git bats-$(TEST_BATS_VERSION) git clone --depth 1 --branch $(TEST_BATS_VERSION) https://github.com/bats-core/bats-core.git bats-$(TEST_BATS_VERSION)

View File

@ -13,6 +13,8 @@ This project was forked from [rbenv](https://github.com/rbenv/rbenv) and
* Lets you **change the global Python version** on a per-user basis. * Lets you **change the global Python version** on a per-user basis.
* Provides support for **per-project Python versions**. * Provides support for **per-project Python versions**.
* Supports **multiple Python distributions**: CPython, PyPy, Stackless Python, Jython, and more.
See the [full list of available versions](https://github.com/pyenv/pyenv/tree/master/plugins/python-build/share/python-build).
* Allows you to **override the Python version** with an environment * Allows you to **override the Python version** with an environment
variable. variable.
* Searches for commands from **multiple versions of Python at a time**. * Searches for commands from **multiple versions of Python at a time**.

View File

@ -473,12 +473,12 @@ function pyenv {
} }
if ( ("${commands[*]}" -split ' ') -contains \$command ) { if ( ("${commands[*]}" -split ' ') -contains \$command ) {
\$shell_cmds = (& (get-command -commandtype application pyenv) sh-\$command \$args) \$shell_cmds = (& (get-command -commandtype application pyenv -totalcount 1) sh-\$command \$args)
if ( \$shell_cmds.Count -gt 0 ) { if ( \$shell_cmds.Count -gt 0 ) {
iex (\$shell_cmds -join "\`n") iex (\$shell_cmds -join "\`n")
} }
} else { } else {
& (get-command -commandtype application pyenv) \$command \$args & (get-command -commandtype application pyenv -totalcount 1) \$command \$args
} }
} }
EOS EOS

1
plugins/.gitignore vendored
View File

@ -3,4 +3,5 @@
!/version-ext-compat !/version-ext-compat
!/python-build !/python-build
!/pyenv-binary !/pyenv-binary
!/pyenv-link
/python-build/test/build /python-build/test/build

View File

@ -14,6 +14,9 @@ architecture and a compatible libc) and have the recorded system libraries. It
is not portable across, say, glibc and musl, or to an older glibc; the platform is not portable across, say, glibc and musl, or to an older glibc; the platform
and dependency metadata exist to catch that. and dependency metadata exist to catch that.
Installing a binary package requires `tar` with xz support (typically provided
by the `xz` package).
## Commands ## Commands
### `pyenv binary package [-v|--verbose] <version>[:<entry>] --archive-base-url <url>` ### `pyenv binary package [-v|--verbose] <version>[:<entry>] --archive-base-url <url>`
@ -29,7 +32,7 @@ Pass `-v` to show build progress from `pyenv install`.
```sh ```sh
pyenv binary package 3.12.7 \ pyenv binary package 3.12.7 \
--archive-base-url https://example.com/binaries --archive-base-url https://example.com/binaries
# On Debian 12 x86_64, writes 3.12.7-debian-12-x86_64.tar.gz, # On Debian 12 x86_64, writes 3.12.7-debian-12-x86_64.tar.xz,
# its .meta file and a `3.12.7-debian-12-x86_64' definition. # its .meta file and a `3.12.7-debian-12-x86_64' definition.
pyenv binary package 3.12.7:company-python \ pyenv binary package 3.12.7:company-python \
@ -54,7 +57,7 @@ pyenv binary package-name 3.12.7
### `pyenv binary save <version> [<output-dir>] [--name <name>]` ### `pyenv binary save <version> [<output-dir>] [--name <name>]`
Packs an installed version into `<version>-<platform>.tar.gz` (relative paths) Packs an installed version into `<version>-<platform>.tar.xz` (relative paths)
and writes `<version>-<platform>.meta` describing the build platform (OS, arch, and writes `<version>-<platform>.meta` describing the build platform (OS, arch,
distro and libc version) and the system libraries the build links against. Use distro and libc version) and the system libraries the build links against. Use
`--name` to set a different base name for both files. `--name` to set a different base name for both files.
@ -78,7 +81,7 @@ needs are present.
```sh ```sh
pyenv binary generate-installer ./dist/3.12.7-linux-x86_64.meta \ pyenv binary generate-installer ./dist/3.12.7-linux-x86_64.meta \
--archive-url https://example.com/3.12.7-linux-x86_64.tar.gz \ --archive-url https://example.com/3.12.7-linux-x86_64.tar.xz \
-o "$(pyenv root)/plugins/python-build/share/python-build/3.12.7-linux-x86_64" -o "$(pyenv root)/plugins/python-build/share/python-build/3.12.7-linux-x86_64"
pyenv install 3.12.7-linux-x86_64 pyenv install 3.12.7-linux-x86_64

View File

@ -7,7 +7,7 @@
# Installs <version> from source under a separate entry name, saves it as a # Installs <version> from source under a separate entry name, saves it as a
# binary package, then emits a python-build definition for that package. # binary package, then emits a python-build definition for that package.
# The archive, metadata and definition are written to the current directory # The archive, metadata and definition are written to the current directory
# as <entry>.tar.gz, <entry>.meta and <entry>. # as <entry>.tar.xz, <entry>.meta and <entry>.
# #
# <version> A version `pyenv install' knows how to build. # <version> A version `pyenv install' knows how to build.
# <entry> The optional name to build under and install the # <entry> The optional name to build under and install the
@ -16,7 +16,7 @@
# -v,--verbose Show build progress from `pyenv install'. # -v,--verbose Show build progress from `pyenv install'.
# --archive-base-url <url> # --archive-base-url <url>
# Where the archive will be hosted; the definition # Where the archive will be hosted; the definition
# downloads it from <url>/<entry>.tar.gz. # downloads it from <url>/<entry>.tar.xz.
# #
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
@ -80,4 +80,4 @@ pyenv-install ${verbose:+--verbose} "$spec"
pyenv-binary-save "$entry" "$PWD" --name "$entry" pyenv-binary-save "$entry" "$PWD" --name "$entry"
pyenv-binary-generate-installer "${entry}.meta" \ pyenv-binary-generate-installer "${entry}.meta" \
--archive-url "${archive_base_url%/}/${entry}.tar.gz" -o "$entry" --archive-url "${archive_base_url%/}/${entry}.tar.xz" -o "$entry"

View File

@ -4,7 +4,7 @@
# #
# Usage: pyenv binary save <version> [<output-dir>] [--name <name>] # Usage: pyenv binary save <version> [<output-dir>] [--name <name>]
# #
# Packs an installed version into a relocatable .tar.gz (relative paths) and # Packs an installed version into a relocatable .tar.xz (relative paths) and
# writes a metadata file listing the build platform and the system libraries # writes a metadata file listing the build platform and the system libraries
# it links against, so an installer can check compatibility before unpacking. # it links against, so an installer can check compatibility before unpacking.
# #
@ -134,10 +134,10 @@ system_deps() {
mkdir -p "$output_dir" mkdir -p "$output_dir"
package_name="${package_name:-${version}-${platform}}" package_name="${package_name:-${version}-${platform}}"
archive="${package_name}.tar.gz" archive="${package_name}.tar.xz"
metadata="${package_name}.meta" metadata="${package_name}.meta"
tar -C "$(dirname "$prefix")" -czf "${output_dir}/${archive}" "$(basename "$prefix")" tar -C "$(dirname "$prefix")" -cJf "${output_dir}/${archive}" "$(basename "$prefix")"
{ {
echo "# pyenv-binary metadata" echo "# pyenv-binary metadata"

View File

@ -66,10 +66,10 @@ pyenv-install --list --bare
run pyenv-binary-package 3.12.7 --archive-base-url http://example.com/binaries run pyenv-binary-package 3.12.7 --archive-base-url http://example.com/binaries
assert_success assert_success
assert [ -d "${PYENV_ROOT}/versions/3.12.7-debian-12-x86_64" ] assert [ -d "${PYENV_ROOT}/versions/3.12.7-debian-12-x86_64" ]
assert [ -f "${BATS_TEST_TMPDIR}/3.12.7-debian-12-x86_64.tar.gz" ] assert [ -f "${BATS_TEST_TMPDIR}/3.12.7-debian-12-x86_64.tar.xz" ]
assert [ -f "${BATS_TEST_TMPDIR}/3.12.7-debian-12-x86_64.meta" ] assert [ -f "${BATS_TEST_TMPDIR}/3.12.7-debian-12-x86_64.meta" ]
run grep '^ARCHIVE_URL=' "${BATS_TEST_TMPDIR}/3.12.7-debian-12-x86_64" run grep '^ARCHIVE_URL=' "${BATS_TEST_TMPDIR}/3.12.7-debian-12-x86_64"
assert_success "ARCHIVE_URL=http://example.com/binaries/3.12.7-debian-12-x86_64.tar.gz" assert_success "ARCHIVE_URL=http://example.com/binaries/3.12.7-debian-12-x86_64.tar.xz"
} }
@test "rejects an entry name containing a slash" { @test "rejects an entry name containing a slash" {
@ -102,10 +102,10 @@ generate-installer"
--archive-base-url http://example.com/binaries --archive-base-url http://example.com/binaries
assert_success assert_success
assert [ -d "${PYENV_ROOT}/versions/3.12.7-test" ] assert [ -d "${PYENV_ROOT}/versions/3.12.7-test" ]
assert [ -f "${BATS_TEST_TMPDIR}/3.12.7-test.tar.gz" ] assert [ -f "${BATS_TEST_TMPDIR}/3.12.7-test.tar.xz" ]
assert [ -f "${BATS_TEST_TMPDIR}/3.12.7-test.meta" ] assert [ -f "${BATS_TEST_TMPDIR}/3.12.7-test.meta" ]
run grep '^ARCHIVE_URL=' "${BATS_TEST_TMPDIR}/3.12.7-test" run grep '^ARCHIVE_URL=' "${BATS_TEST_TMPDIR}/3.12.7-test"
assert_success "ARCHIVE_URL=http://example.com/binaries/3.12.7-test.tar.gz" assert_success "ARCHIVE_URL=http://example.com/binaries/3.12.7-test.tar.xz"
} }
@test "correctly joins archive base url with a trailing slash" { @test "correctly joins archive base url with a trailing slash" {
@ -127,5 +127,5 @@ done
run pyenv-binary-package 3.12.7:3.12.7-test \ run pyenv-binary-package 3.12.7:3.12.7-test \
--archive-base-url http://example.com/binaries/ --archive-base-url http://example.com/binaries/
assert_success assert_success
assert_line "pyenv-binary-generate-installer --archive-url http://example.com/binaries/3.12.7-test.tar.gz" assert_line "pyenv-binary-generate-installer --archive-url http://example.com/binaries/3.12.7-test.tar.xz"
} }

View File

@ -33,13 +33,13 @@ platform() {
@test "packages an installed version" { @test "packages an installed version" {
create_version "3.12.7" create_version "3.12.7"
local out="${BATS_TEST_TMPDIR}/dist" local out="${BATS_TEST_TMPDIR}/dist"
local archive="${out}/3.12.7-$(platform).tar.gz" local archive="${out}/3.12.7-$(platform).tar.xz"
run pyenv-binary-save "3.12.7" "$out" run pyenv-binary-save "3.12.7" "$out"
assert_success "Saved 3.12.7-$(platform).tar.gz and 3.12.7-$(platform).meta to $out" assert_success "Saved 3.12.7-$(platform).tar.xz and 3.12.7-$(platform).meta to $out"
assert [ -f "$archive" ] assert [ -f "$archive" ]
assert [ -f "${out}/3.12.7-$(platform).meta" ] assert [ -f "${out}/3.12.7-$(platform).meta" ]
run tar -tzf "$archive" run tar -tJf "$archive"
assert_success assert_success
assert_line 0 "3.12.7/" assert_line 0 "3.12.7/"
} }
@ -49,10 +49,10 @@ platform() {
local out="${BATS_TEST_TMPDIR}/dist" local out="${BATS_TEST_TMPDIR}/dist"
run pyenv-binary-save "3.12.7" "$out" --name "custom" run pyenv-binary-save "3.12.7" "$out" --name "custom"
assert_success "Saved custom.tar.gz and custom.meta to $out" assert_success "Saved custom.tar.xz and custom.meta to $out"
assert [ -f "${out}/custom.tar.gz" ] assert [ -f "${out}/custom.tar.xz" ]
run grep '^archive=' "${out}/custom.meta" run grep '^archive=' "${out}/custom.meta"
assert_success "archive=custom.tar.gz" assert_success "archive=custom.tar.xz"
} }
@test "fails when --name has no value" { @test "fails when --name has no value" {
@ -76,7 +76,7 @@ platform() {
assert_success assert_success
assert_line "version=3.12.7" assert_line "version=3.12.7"
assert_line "platform=$(platform)" assert_line "platform=$(platform)"
assert_line "archive=3.12.7-$(platform).tar.gz" assert_line "archive=3.12.7-$(platform).tar.xz"
} }
@test "records the original installation prefix" { @test "records the original installation prefix" {
@ -94,7 +94,7 @@ platform() {
PATH="$(path_without readelf)" run pyenv-binary-save "3.12.7" "${BATS_TEST_TMPDIR}/dist" PATH="$(path_without readelf)" run pyenv-binary-save "3.12.7" "${BATS_TEST_TMPDIR}/dist"
assert_failure "pyenv-binary: need readelf to inspect shared libraries" assert_failure "pyenv-binary: need readelf to inspect shared libraries"
assert [ ! -e "${BATS_TEST_TMPDIR}/dist/3.12.7-$(platform).tar.gz" ] assert [ ! -e "${BATS_TEST_TMPDIR}/dist/3.12.7-$(platform).tar.xz" ]
} }
@test "records only direct libraries resolved outside the prefix" { @test "records only direct libraries resolved outside the prefix" {

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 yfprojects
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,33 @@
# pyenv-link
A [pyenv](https://github.com/pyenv/pyenv) plugin for linking Python installations and virtual environments into your pyenv root.
This plugin recommends the [pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv/) plugin.
## Usage
Make an arbitrary virtualenv available through pyenv. This automatically guesses a fitting name from the prompt, the directory name or the location of the venv.
```console
$ pyenv link version .venv
Linked new version named myproject
```
You can also specify a name to use for the venv.
```console
$ pyenv link version .venv myname
Linked new version named myname
```
The same command can give a platform-specific binary installation a shorter name:
```console
$ pyenv link version "$(pyenv root)/versions/3.13.14-linux-x86_64" 3.13.14
Linked new version named 3.13.14
```
Now you can make pyenv activate/use the venv automatically:
```console
$ pyenv local myproject
```

View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
#
# Summary: Link a Python environment as a pyenv version
#
# Usage: pyenv link version [--dry] [--quiet] <path> [<name>]
#
# Link a virtual python environment to pyenvs version directory
# so that the venv can be used like one created with *pyenv-virtualenv*.
#
# <path> should be a path to a Python installation or virtual environment.
set -e
[ -n "$PYENV_DEBUG" ] && set -x
# Provide pyenv completions
case "$1" in
--complete)
if [ -z "$2" ]; then
echo version
else
shift 2
pyenv-link-version --complete "$@"
fi
;;
version)
shift
pyenv-link-version "$@"
exit $?
;;
*)
pyenv-help --usage link >&2
exit 1
;;
esac

View File

@ -0,0 +1,150 @@
#!/usr/bin/env bash
#
# Summary: Link a Python environment as a pyenv version
#
# Usage: pyenv link version [--dry] [--quiet] <path> [<name>]
#
# Link a virtual python environment to pyenvs version directory
# so that the venv can be used like one created with *pyenv-virtualenv*.
#
# <path> should be a path to a Python installation or virtual environment.
# <name> should be string used as a version name it may not be present
# in the pyenv version directory yet.
# If not specified a matching name is guessed from pyvenv.cfg
# or directory name of the venv.
set -e
[ -n "$PYENV_DEBUG" ] && set -x
# functions
if ! {
enable -f "${BASH_SOURCE%/*}"/../../../libexec/pyenv-realpath.dylib realpath ||
type realpath # realpath available?
} >/dev/null 2>&1; then
# realpath requires GNU coreutils to be installed. That's why its bundled with pyenv
echo realpath not available >&2
# work-around when realpath is unavailable
realpath() {
(cd "$1" && pwd)
}
fi
guess_name() {
local venv_dir=$1
local name
# guess venv name from pyvenv.cfg
local pyvenv_cfg_path=$venv_dir/pyvenv.cfg
if [ -f "$pyvenv_cfg_path" ]; then
# if `prompt` key wasn't found the var remains empty
name=$(cut -b 1-1024 "$pyvenv_cfg_path" | sed -n '/^ *prompt *= */s///p')
case "$name" in
\"*\" | \'*\')
name=${name:1:${#name}-2}
;;
esac
fi
# guess venv name from name of venv directory
local venv_dir_name=${venv_dir##*/}
if [ -z "$name" ]; then
case "$venv_dir_name" in
venv | env | .venv | .env | ENV | VENV) ;;
*) name=$venv_dir_name ;;
esac
fi
# guess venv name from name of the parent directory of the venv directory
local venv_dir_parent=${venv_dir%/*}
local venv_dir_parent_name=${venv_dir_parent##*/}
if [ -z "$name" ]; then
name=$venv_dir_parent_name
fi
echo "$name"
}
# process args
POSARGS=()
# Provide pyenv completions
if [ "$1" = "--complete" ]; then
echo --dry
echo --quiet
exit
fi
for arg in "$@"; do
case $arg in
--dry)
dry=true # any value
;;
--quiet)
quiet=true # any value
;;
-*)
pyenv-help --usage link-version >&2
exit 1
;;
*)
POSARGS+=("$arg")
;;
esac
done
if [ ! ${#POSARGS[@]} -le 2 ] || [ ! ${#POSARGS[@]} -ge 1 ]; then
pyenv-help --usage link-version >&2
exit 1
fi
venv_dir=${POSARGS[0]%/}
venv_name=${POSARGS[1]}
# Check venv exists
if [ ! -d "$venv_dir" ]; then
echo "The virtual env you specified doesn't exist"
exit 2
fi
# make venv dir absolute
venv_dir=$(realpath "$venv_dir")
# determine venv name
if [ -z "$venv_name" ]; then
venv_name=$(guess_name "$venv_dir")
fi
case "$venv_name" in
"" | */* | . | .. | *:* | system | *[[:cntrl:]]* )
echo "pyenv-link: invalid version name \`${venv_name}'" >&2
exit 1
;;
esac
versions_dir="$PYENV_ROOT/versions"
pyenv_prefix_path="$versions_dir/$venv_name"
if [ -e "$pyenv_prefix_path" ] || [ -L "$pyenv_prefix_path" ]; then
echo Version "$venv_name" already exists >&2
exit 3
fi
case "$venv_dir" in
"$versions_dir"/*)
link_target=${venv_dir#"$versions_dir"/}
;;
*)
link_target=$venv_dir
;;
esac
# link to pyenv version directory
if [ -z "$dry" ]; then
mkdir -p "$versions_dir"
ln -s "$link_target" "$pyenv_prefix_path"
fi
# output
if [ -z "$quiet" ]; then
echo "Linked new version named $venv_name"
fi

View File

@ -0,0 +1,61 @@
#!/usr/bin/env bats
load test_helper
@test "link completions use the dispatcher" {
run pyenv completions link
assert_success
assert_output <<OUT
--help
version
OUT
run pyenv completions link version
assert_success
assert_output <<OUT
--help
--dry
--quiet
OUT
}
@test "link requires a version path" {
run pyenv-link version
assert_failure "Usage: pyenv link version [--dry] [--quiet] <path> [<name>]"
}
@test "links an installed binary under its plain version name" {
create_alt_executable_in_version "3.13.14-linux-x86_64" python 'echo linked-python'
run pyenv-link version "$PYENV_ROOT/versions/3.13.14-linux-x86_64" 3.13.14
assert_success "Linked new version named 3.13.14"
assert_equal "3.13.14-linux-x86_64" "$(readlink "$PYENV_ROOT/versions/3.13.14")"
PYENV_VERSION=3.13.14 run pyenv exec python
assert_success "linked-python"
}
@test "links external paths containing spaces into a fresh root" {
mkdir -p "$PYENV_TEST_DIR/external env/bin"
run pyenv-link version "$PYENV_TEST_DIR/external env" custom
assert_success "Linked new version named custom"
assert_equal "$PYENV_TEST_DIR/external env" "$(readlink "$PYENV_ROOT/versions/custom")"
}
@test "refuses a dangling destination link" {
mkdir -p "$PYENV_ROOT/versions" "$PYENV_TEST_DIR/source"
ln -s missing "$PYENV_ROOT/versions/dangling"
run pyenv-link version "$PYENV_TEST_DIR/source" dangling
assert_failure "Version dangling already exists"
assert_equal missing "$(readlink "$PYENV_ROOT/versions/dangling")"
}
@test "rejects invalid version names" {
mkdir -p "$PYENV_TEST_DIR/source"
for name in ../outside . .. 'foo/bar' 'foo:bar' system; do
run pyenv-link version "$PYENV_TEST_DIR/source" "$name"
assert_failure "pyenv-link: invalid version name \`$name'"
assert [ ! -e "$PYENV_ROOT/outside" ]
done
echo "prompt = '../outside'" > "$PYENV_TEST_DIR/source/pyvenv.cfg"
run pyenv-link version "$PYENV_TEST_DIR/source"
assert_failure "pyenv-link: invalid version name \`../outside'"
assert [ ! -e "$PYENV_ROOT/outside" ]
}

View File

@ -0,0 +1 @@
../../../test/test_helper.bash

View File

@ -54,8 +54,11 @@ Or, if you would like to install the latest development release:
## Usage ## Usage
Before you begin, you should ensure that your build environment has the proper On Ubuntu, Debian, and Mint, install the recommended build dependencies with:
system dependencies for compiling the wanted Python Version (see our [recommendations](https://github.com/pyenv/pyenv/wiki#suggested-build-environment)).
pyenv install-prerequisites
For other environments, see our [build environment recommendations](https://github.com/pyenv/pyenv/wiki#suggested-build-environment).
### Using `pyenv install` with pyenv ### Using `pyenv install` with pyenv
@ -361,4 +364,3 @@ git diff --name-only master \
- Filter out any which don't live where python-build keeps its build scripts - Filter out any which don't live where python-build keeps its build scripts
- Look only at the file name (i.e. the python version name) - Look only at the file name (i.e. the python version name)
- Run a new docker container for each, building that version - Run a new docker container for each, building that version

View File

@ -0,0 +1,47 @@
#!/usr/bin/env bash
#
# Summary: Install Python build prerequisites on Debian-based systems
#
# Usage: pyenv install-prerequisites
#
set -e
[ -n "$PYENV_DEBUG" ] && set -x
# Provide pyenv completions
if [ "$1" = "--complete" ]; then
exit
fi
usage() {
pyenv-help install-prerequisites 2>/dev/null
[ -z "$1" ] || exit "$1"
}
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
usage 0
fi
[ "$#" -eq 0 ] || usage 1 >&2
if ! command -v apt-get >/dev/null; then
echo "pyenv: installing build prerequisites is not supported on this system" >&2
exit 1
fi
prerequisites=(
make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev
libsqlite3-dev curl git llvm libncurses5-dev libncursesw5-dev xz-utils
tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev libzstd-dev
)
if [ "$(id -u)" -eq 0 ]; then
apt_get=(apt-get)
elif command -v sudo >/dev/null; then
apt_get=(sudo apt-get)
else
echo "pyenv: sudo is required to install build prerequisites" >&2
exit 1
fi
"${apt_get[@]}" update -q
"${apt_get[@]}" install -yq "${prerequisites[@]}"

View File

@ -873,6 +873,7 @@ build_package_standard_build() {
if [ "$package_var_name" = "PYTHON" ]; then if [ "$package_var_name" = "PYTHON" ]; then
if can_use_homebrew; then if can_use_homebrew; then
configured_with_openssl || use_homebrew_openssl || true
use_custom_tcltk || use_homebrew_tcltk || true use_custom_tcltk || use_homebrew_tcltk || true
use_homebrew_readline || true use_homebrew_readline || true
use_homebrew_ncurses || true use_homebrew_ncurses || true
@ -885,6 +886,7 @@ build_package_standard_build() {
fi fi
fi fi
if can_use_macports; then if can_use_macports; then
configured_with_openssl || use_macports_openssl || true
use_custom_tcltk || true use_custom_tcltk || true
use_macports_readline || true use_macports_readline || true
use_macports_ncurses || true use_macports_ncurses || true
@ -1705,8 +1707,17 @@ build_package_mac_readline() {
build_package_standard "$@" build_package_standard "$@"
} }
configured_with_openssl() {
local arg
for arg in ${CONFIGURE_OPTS} ${PYTHON_CONFIGURE_OPTS} "${PYTHON_CONFIGURE_OPTS_ARRAY[@]}"; do
[[ "$arg" =~ ^--with-openssl(=|$) ]] && return 0
done
return 1
}
has_broken_mac_openssl() { has_broken_mac_openssl() {
is_mac || return 1 is_mac || return 1
configured_with_openssl && return 1
local openssl_version="$(/usr/bin/openssl version 2>/dev/null || true)" local openssl_version="$(/usr/bin/openssl version 2>/dev/null || true)"
if [[ $openssl_version = "OpenSSL 0.9.8"?* || $openssl_version = "LibreSSL"* ]]; then if [[ $openssl_version = "OpenSSL 0.9.8"?* || $openssl_version = "LibreSSL"* ]]; then
if can_use_homebrew; then if can_use_homebrew; then

View File

@ -0,0 +1,2 @@
export PYTHON_BUILD_FREE_THREADING=1
source "${BASH_SOURCE[0]%t}"

View File

@ -0,0 +1,119 @@
From ac12d63bf188f9497f8453c0447b9bc599acbf22 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 10:30:17 +0300
Subject: [PATCH] (downstream) [3.12] gh-153711: Avoid use of dup3 and pipe2
calls introduced in macOS 27 (#155211)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 33 +++++++++++--------
configure.ac | 11 +++++--
3 files changed, 32 insertions(+), 15 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 b6f90bcd8c7..b93aab935ce 100755
--- a/configure
+++ b/configure
@@ -17552,13 +17552,7 @@ fi
ac_fn_c_check_func "$LINENO" "dup" "ac_cv_func_dup"
if test "x$ac_cv_func_dup" = xyes
then :
- printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-
-fi
-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
+ printf '%s\n' "#define HAVE_DUP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "execv" "ac_cv_func_execv"
@@ -18028,12 +18022,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -18608,6 +18596,25 @@ fi
fi
+# 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" != "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
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
if test ${ac_cv_c_undeclared_builtin_options+y}
diff --git a/configure.ac b/configure.ac
index ba768aea930..92049fb2889 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4860,7 +4860,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid getentropy geteuid getgid getgrgid getgrgid_r \
@@ -4870,7 +4870,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
pread preadv preadv2 pthread_condattr_setclock pthread_init pthread_kill \
pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
rtpSpawn sched_get_priority_max sched_rr_get_interval sched_setaffinity \
@@ -4892,6 +4892,13 @@ if test "$MACHDEP" != linux; then
AC_CHECK_FUNCS([lchmod])
fi
+# 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" != "Darwin"; then
+ AC_CHECK_FUNCS([dup3 pipe2])
+fi
+
AC_CHECK_DECL([dirfd],
[AC_DEFINE([HAVE_DIRFD], [1],
[Define if you have the 'dirfd' function or macro.])],
--
2.55.0.windows.3

View File

@ -0,0 +1,119 @@
From a4b6c2946c6be5b732a3a3d30b8ac75673bc71e6 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 10:30:17 +0300
Subject: [PATCH] (downstream) [3.12] gh-153711: Avoid use of dup3 and pipe2
calls introduced in macOS 27 (#155211)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 33 +++++++++++--------
configure.ac | 11 +++++--
3 files changed, 32 insertions(+), 15 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 99dd1fe5958..52c4790ac74 100755
--- a/configure
+++ b/configure
@@ -17566,13 +17566,7 @@ fi
ac_fn_c_check_func "$LINENO" "dup" "ac_cv_func_dup"
if test "x$ac_cv_func_dup" = xyes
then :
- printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-
-fi
-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
+ printf '%s\n' "#define HAVE_DUP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "execv" "ac_cv_func_execv"
@@ -18042,12 +18036,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -18622,6 +18610,25 @@ fi
fi
+# 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" != "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
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
if test ${ac_cv_c_undeclared_builtin_options+y}
diff --git a/configure.ac b/configure.ac
index bd2be94b47c..45212bd6040 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4870,7 +4870,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid getentropy geteuid getgid getgrgid getgrgid_r \
@@ -4880,7 +4880,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
pread preadv preadv2 pthread_condattr_setclock pthread_init pthread_kill \
pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
rtpSpawn sched_get_priority_max sched_rr_get_interval sched_setaffinity \
@@ -4902,6 +4902,13 @@ if test "$MACHDEP" != linux; then
AC_CHECK_FUNCS([lchmod])
fi
+# 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" != "Darwin"; then
+ AC_CHECK_FUNCS([dup3 pipe2])
+fi
+
AC_CHECK_DECL([dirfd],
[AC_DEFINE([HAVE_DIRFD], [1],
[Define if you have the 'dirfd' function or macro.])],
--
2.55.0.windows.3

View File

@ -0,0 +1,119 @@
From 0e76b1b0219d61d389ddc4516fceb339608c6bf5 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 10:30:17 +0300
Subject: [PATCH] (downstream) [3.12] gh-153711: Avoid use of dup3 and pipe2
calls introduced in macOS 27 (#155211)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 33 +++++++++++--------
configure.ac | 11 +++++--
3 files changed, 32 insertions(+), 15 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 89edc42f45c..e099c5ad55a 100755
--- a/configure
+++ b/configure
@@ -17614,13 +17614,7 @@ fi
ac_fn_c_check_func "$LINENO" "dup" "ac_cv_func_dup"
if test "x$ac_cv_func_dup" = xyes
then :
- printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-
-fi
-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
+ printf '%s\n' "#define HAVE_DUP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "execv" "ac_cv_func_execv"
@@ -18090,12 +18084,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -18670,6 +18658,25 @@ fi
fi
+# 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" != "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
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
if test ${ac_cv_c_undeclared_builtin_options+y}
diff --git a/configure.ac b/configure.ac
index 1a02d19f1b2..f2b58421d74 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4920,7 +4920,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid getentropy geteuid getgid getgrgid getgrgid_r \
@@ -4930,7 +4930,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
pread preadv preadv2 pthread_condattr_setclock pthread_init pthread_kill \
pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
rtpSpawn sched_get_priority_max sched_rr_get_interval sched_setaffinity \
@@ -4952,6 +4952,13 @@ if test "$MACHDEP" != linux; then
AC_CHECK_FUNCS([lchmod])
fi
+# 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" != "Darwin"; then
+ AC_CHECK_FUNCS([dup3 pipe2])
+fi
+
AC_CHECK_DECL([dirfd],
[AC_DEFINE([HAVE_DIRFD], [1],
[Define if you have the 'dirfd' function or macro.])],
--
2.55.0.windows.3

View File

@ -0,0 +1,119 @@
From a4720333372f8d13138101cf9d51033eacf1d422 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 10:30:17 +0300
Subject: [PATCH] (downstream) [3.12] gh-153711: Avoid use of dup3 and pipe2
calls introduced in macOS 27 (#155211)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 33 +++++++++++--------
configure.ac | 11 +++++--
3 files changed, 32 insertions(+), 15 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 89edc42f45c..e099c5ad55a 100755
--- a/configure
+++ b/configure
@@ -17614,13 +17614,7 @@ fi
ac_fn_c_check_func "$LINENO" "dup" "ac_cv_func_dup"
if test "x$ac_cv_func_dup" = xyes
then :
- printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-
-fi
-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
+ printf '%s\n' "#define HAVE_DUP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "execv" "ac_cv_func_execv"
@@ -18090,12 +18084,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -18670,6 +18658,25 @@ fi
fi
+# 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" != "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
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
if test ${ac_cv_c_undeclared_builtin_options+y}
diff --git a/configure.ac b/configure.ac
index 1a02d19f1b2..f2b58421d74 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4920,7 +4920,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid getentropy geteuid getgid getgrgid getgrgid_r \
@@ -4930,7 +4930,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
pread preadv preadv2 pthread_condattr_setclock pthread_init pthread_kill \
pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
rtpSpawn sched_get_priority_max sched_rr_get_interval sched_setaffinity \
@@ -4952,6 +4952,13 @@ if test "$MACHDEP" != linux; then
AC_CHECK_FUNCS([lchmod])
fi
+# 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" != "Darwin"; then
+ AC_CHECK_FUNCS([dup3 pipe2])
+fi
+
AC_CHECK_DECL([dirfd],
[AC_DEFINE([HAVE_DIRFD], [1],
[Define if you have the 'dirfd' function or macro.])],
--
2.55.0.windows.3

View File

@ -0,0 +1,119 @@
From 9bd15ba319eb324b12a6ecf43a4b30c5fcdcdc83 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 10:30:17 +0300
Subject: [PATCH] (downstream) [3.12] gh-153711: Avoid use of dup3 and pipe2
calls introduced in macOS 27 (#155211)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 33 +++++++++++--------
configure.ac | 11 +++++--
3 files changed, 32 insertions(+), 15 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 89edc42f45c..e099c5ad55a 100755
--- a/configure
+++ b/configure
@@ -17614,13 +17614,7 @@ fi
ac_fn_c_check_func "$LINENO" "dup" "ac_cv_func_dup"
if test "x$ac_cv_func_dup" = xyes
then :
- printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-
-fi
-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
+ printf '%s\n' "#define HAVE_DUP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "execv" "ac_cv_func_execv"
@@ -18090,12 +18084,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -18670,6 +18658,25 @@ fi
fi
+# 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" != "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
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
if test ${ac_cv_c_undeclared_builtin_options+y}
diff --git a/configure.ac b/configure.ac
index 1a02d19f1b2..f2b58421d74 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4920,7 +4920,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid getentropy geteuid getgid getgrgid getgrgid_r \
@@ -4930,7 +4930,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
pread preadv preadv2 pthread_condattr_setclock pthread_init pthread_kill \
pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
rtpSpawn sched_get_priority_max sched_rr_get_interval sched_setaffinity \
@@ -4952,6 +4952,13 @@ if test "$MACHDEP" != linux; then
AC_CHECK_FUNCS([lchmod])
fi
+# 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" != "Darwin"; then
+ AC_CHECK_FUNCS([dup3 pipe2])
+fi
+
AC_CHECK_DECL([dirfd],
[AC_DEFINE([HAVE_DIRFD], [1],
[Define if you have the 'dirfd' function or macro.])],
--
2.55.0.windows.3

View File

@ -0,0 +1,119 @@
From 4cfd78f7b5128da5ca9628de77feec4b768c2531 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 10:30:17 +0300
Subject: [PATCH] (downstream) [3.12] gh-153711: Avoid use of dup3 and pipe2
calls introduced in macOS 27 (#155211)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 33 +++++++++++--------
configure.ac | 11 +++++--
3 files changed, 32 insertions(+), 15 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 89edc42f45c..e099c5ad55a 100755
--- a/configure
+++ b/configure
@@ -17614,13 +17614,7 @@ fi
ac_fn_c_check_func "$LINENO" "dup" "ac_cv_func_dup"
if test "x$ac_cv_func_dup" = xyes
then :
- printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-
-fi
-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
+ printf '%s\n' "#define HAVE_DUP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "execv" "ac_cv_func_execv"
@@ -18090,12 +18084,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -18670,6 +18658,25 @@ fi
fi
+# 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" != "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
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
if test ${ac_cv_c_undeclared_builtin_options+y}
diff --git a/configure.ac b/configure.ac
index 1a02d19f1b2..f2b58421d74 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4920,7 +4920,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid getentropy geteuid getgid getgrgid getgrgid_r \
@@ -4930,7 +4930,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
pread preadv preadv2 pthread_condattr_setclock pthread_init pthread_kill \
pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
rtpSpawn sched_get_priority_max sched_rr_get_interval sched_setaffinity \
@@ -4952,6 +4952,13 @@ if test "$MACHDEP" != linux; then
AC_CHECK_FUNCS([lchmod])
fi
+# 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" != "Darwin"; then
+ AC_CHECK_FUNCS([dup3 pipe2])
+fi
+
AC_CHECK_DECL([dirfd],
[AC_DEFINE([HAVE_DIRFD], [1],
[Define if you have the 'dirfd' function or macro.])],
--
2.55.0.windows.3

View File

@ -0,0 +1,119 @@
From ac12d63bf188f9497f8453c0447b9bc599acbf22 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 10:30:17 +0300
Subject: [PATCH] (downstream) [3.12] gh-153711: Avoid use of dup3 and pipe2
calls introduced in macOS 27 (#155211)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 33 +++++++++++--------
configure.ac | 11 +++++--
3 files changed, 32 insertions(+), 15 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 b6f90bcd8c7..b93aab935ce 100755
--- a/configure
+++ b/configure
@@ -17552,13 +17552,7 @@ fi
ac_fn_c_check_func "$LINENO" "dup" "ac_cv_func_dup"
if test "x$ac_cv_func_dup" = xyes
then :
- printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-
-fi
-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
+ printf '%s\n' "#define HAVE_DUP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "execv" "ac_cv_func_execv"
@@ -18028,12 +18022,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -18608,6 +18596,25 @@ fi
fi
+# 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" != "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
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
if test ${ac_cv_c_undeclared_builtin_options+y}
diff --git a/configure.ac b/configure.ac
index ba768aea930..92049fb2889 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4860,7 +4860,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid getentropy geteuid getgid getgrgid getgrgid_r \
@@ -4870,7 +4870,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
pread preadv preadv2 pthread_condattr_setclock pthread_init pthread_kill \
pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
rtpSpawn sched_get_priority_max sched_rr_get_interval sched_setaffinity \
@@ -4892,6 +4892,13 @@ if test "$MACHDEP" != linux; then
AC_CHECK_FUNCS([lchmod])
fi
+# 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" != "Darwin"; then
+ AC_CHECK_FUNCS([dup3 pipe2])
+fi
+
AC_CHECK_DECL([dirfd],
[AC_DEFINE([HAVE_DIRFD], [1],
[Define if you have the 'dirfd' function or macro.])],
--
2.55.0.windows.3

View File

@ -0,0 +1,119 @@
From 2b0563ccd3da13eba12ceb53cfca3792df7bec44 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 10:30:17 +0300
Subject: [PATCH] (downstream) [3.12] gh-153711: Avoid use of dup3 and pipe2
calls introduced in macOS 27 (#155211)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 33 +++++++++++--------
configure.ac | 11 +++++--
3 files changed, 32 insertions(+), 15 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 e962a6aed12..7a7e3204ea9 100755
--- a/configure
+++ b/configure
@@ -17566,13 +17566,7 @@ fi
ac_fn_c_check_func "$LINENO" "dup" "ac_cv_func_dup"
if test "x$ac_cv_func_dup" = xyes
then :
- printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-
-fi
-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
+ printf '%s\n' "#define HAVE_DUP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "execv" "ac_cv_func_execv"
@@ -18042,12 +18036,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -18622,6 +18610,25 @@ fi
fi
+# 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" != "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
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
if test ${ac_cv_c_undeclared_builtin_options+y}
diff --git a/configure.ac b/configure.ac
index 384718db1f0..7f117003df7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4870,7 +4870,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid getentropy geteuid getgid getgrgid getgrgid_r \
@@ -4880,7 +4880,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
pread preadv preadv2 pthread_condattr_setclock pthread_init pthread_kill \
pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
rtpSpawn sched_get_priority_max sched_rr_get_interval sched_setaffinity \
@@ -4902,6 +4902,13 @@ if test "$MACHDEP" != linux; then
AC_CHECK_FUNCS([lchmod])
fi
+# 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" != "Darwin"; then
+ AC_CHECK_FUNCS([dup3 pipe2])
+fi
+
AC_CHECK_DECL([dirfd],
[AC_DEFINE([HAVE_DIRFD], [1],
[Define if you have the 'dirfd' function or macro.])],
--
2.55.0.windows.3

View File

@ -0,0 +1,119 @@
From c167d889c264347c658365acbb70bdd71c81550d Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 10:30:17 +0300
Subject: [PATCH] (downstream) [3.12] gh-153711: Avoid use of dup3 and pipe2
calls introduced in macOS 27 (#155211)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 33 +++++++++++--------
configure.ac | 11 +++++--
3 files changed, 32 insertions(+), 15 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 be783faa248..87fca7d195f 100755
--- a/configure
+++ b/configure
@@ -17591,13 +17591,7 @@ fi
ac_fn_c_check_func "$LINENO" "dup" "ac_cv_func_dup"
if test "x$ac_cv_func_dup" = xyes
then :
- printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-
-fi
-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
+ printf '%s\n' "#define HAVE_DUP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "execv" "ac_cv_func_execv"
@@ -18067,12 +18061,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -18647,6 +18635,25 @@ fi
fi
+# 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" != "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
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
if test ${ac_cv_c_undeclared_builtin_options+y}
diff --git a/configure.ac b/configure.ac
index 8be26cc0ab7..313b5bd62ce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4888,7 +4888,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid getentropy geteuid getgid getgrgid getgrgid_r \
@@ -4898,7 +4898,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
pread preadv preadv2 pthread_condattr_setclock pthread_init pthread_kill \
pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
rtpSpawn sched_get_priority_max sched_rr_get_interval sched_setaffinity \
@@ -4920,6 +4920,13 @@ if test "$MACHDEP" != linux; then
AC_CHECK_FUNCS([lchmod])
fi
+# 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" != "Darwin"; then
+ AC_CHECK_FUNCS([dup3 pipe2])
+fi
+
AC_CHECK_DECL([dirfd],
[AC_DEFINE([HAVE_DIRFD], [1],
[Define if you have the 'dirfd' function or macro.])],
--
2.55.0.windows.3

View File

@ -0,0 +1,119 @@
From 9e0a06e1ad5baa743064a4ef3b9b0faf83e3d061 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 10:30:17 +0300
Subject: [PATCH] (downstream) [3.12] gh-153711: Avoid use of dup3 and pipe2
calls introduced in macOS 27 (#155211)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 33 +++++++++++--------
configure.ac | 11 +++++--
3 files changed, 32 insertions(+), 15 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 6dc8a66e487..b2ce2542b9d 100755
--- a/configure
+++ b/configure
@@ -17591,13 +17591,7 @@ fi
ac_fn_c_check_func "$LINENO" "dup" "ac_cv_func_dup"
if test "x$ac_cv_func_dup" = xyes
then :
- printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-
-fi
-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
+ printf '%s\n' "#define HAVE_DUP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "execv" "ac_cv_func_execv"
@@ -18067,12 +18061,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -18647,6 +18635,25 @@ fi
fi
+# 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" != "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
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
if test ${ac_cv_c_undeclared_builtin_options+y}
diff --git a/configure.ac b/configure.ac
index 8a32cb58f4e..0cec0c7aeea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4896,7 +4896,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid getentropy geteuid getgid getgrgid getgrgid_r \
@@ -4906,7 +4906,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
pread preadv preadv2 pthread_condattr_setclock pthread_init pthread_kill \
pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
rtpSpawn sched_get_priority_max sched_rr_get_interval sched_setaffinity \
@@ -4928,6 +4928,13 @@ if test "$MACHDEP" != linux; then
AC_CHECK_FUNCS([lchmod])
fi
+# 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" != "Darwin"; then
+ AC_CHECK_FUNCS([dup3 pipe2])
+fi
+
AC_CHECK_DECL([dirfd],
[AC_DEFINE([HAVE_DIRFD], [1],
[Define if you have the 'dirfd' function or macro.])],
--
2.55.0.windows.3

View File

@ -0,0 +1,119 @@
From 16d9ac47e5e6b6e8020049622c697e8118999480 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 10:30:17 +0300
Subject: [PATCH] (downstream) [3.12] gh-153711: Avoid use of dup3 and pipe2
calls introduced in macOS 27 (#155211)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 33 +++++++++++--------
configure.ac | 11 +++++--
3 files changed, 32 insertions(+), 15 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 4dfaeecfc0b..bec4c9ac763 100755
--- a/configure
+++ b/configure
@@ -17591,13 +17591,7 @@ fi
ac_fn_c_check_func "$LINENO" "dup" "ac_cv_func_dup"
if test "x$ac_cv_func_dup" = xyes
then :
- printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-
-fi
-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
+ printf '%s\n' "#define HAVE_DUP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "execv" "ac_cv_func_execv"
@@ -18067,12 +18061,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -18647,6 +18635,25 @@ fi
fi
+# 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" != "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
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
if test ${ac_cv_c_undeclared_builtin_options+y}
diff --git a/configure.ac b/configure.ac
index 0d6df8e24e4..cbf749da60b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4896,7 +4896,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid getentropy geteuid getgid getgrgid getgrgid_r \
@@ -4906,7 +4906,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
pread preadv preadv2 pthread_condattr_setclock pthread_init pthread_kill \
pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
rtpSpawn sched_get_priority_max sched_rr_get_interval sched_setaffinity \
@@ -4928,6 +4928,13 @@ if test "$MACHDEP" != linux; then
AC_CHECK_FUNCS([lchmod])
fi
+# 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" != "Darwin"; then
+ AC_CHECK_FUNCS([dup3 pipe2])
+fi
+
AC_CHECK_DECL([dirfd],
[AC_DEFINE([HAVE_DIRFD], [1],
[Define if you have the 'dirfd' function or macro.])],
--
2.55.0.windows.3

View File

@ -0,0 +1,119 @@
From 33d7809038f73f689c4a7d622dbf49e90774f1ff Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 10:30:17 +0300
Subject: [PATCH] (downstream) [3.12] gh-153711: Avoid use of dup3 and pipe2
calls introduced in macOS 27 (#155211)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 33 +++++++++++--------
configure.ac | 11 +++++--
3 files changed, 32 insertions(+), 15 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 4dfaeecfc0b..bec4c9ac763 100755
--- a/configure
+++ b/configure
@@ -17591,13 +17591,7 @@ fi
ac_fn_c_check_func "$LINENO" "dup" "ac_cv_func_dup"
if test "x$ac_cv_func_dup" = xyes
then :
- printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-
-fi
-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
+ printf '%s\n' "#define HAVE_DUP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "execv" "ac_cv_func_execv"
@@ -18067,12 +18061,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -18647,6 +18635,25 @@ fi
fi
+# 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" != "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
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
if test ${ac_cv_c_undeclared_builtin_options+y}
diff --git a/configure.ac b/configure.ac
index 0d6df8e24e4..cbf749da60b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4896,7 +4896,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid getentropy geteuid getgid getgrgid getgrgid_r \
@@ -4906,7 +4906,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
pread preadv preadv2 pthread_condattr_setclock pthread_init pthread_kill \
pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
rtpSpawn sched_get_priority_max sched_rr_get_interval sched_setaffinity \
@@ -4928,6 +4928,13 @@ if test "$MACHDEP" != linux; then
AC_CHECK_FUNCS([lchmod])
fi
+# 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" != "Darwin"; then
+ AC_CHECK_FUNCS([dup3 pipe2])
+fi
+
AC_CHECK_DECL([dirfd],
[AC_DEFINE([HAVE_DIRFD], [1],
[Define if you have the 'dirfd' function or macro.])],
--
2.55.0.windows.3

View File

@ -0,0 +1,119 @@
From 2b8183e6b45ec2b5d591c034687e7f0ba5eb1bbc Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 10:30:17 +0300
Subject: [PATCH] (downstream) [3.12] gh-153711: Avoid use of dup3 and pipe2
calls introduced in macOS 27 (#155211)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 33 +++++++++++--------
configure.ac | 11 +++++--
3 files changed, 32 insertions(+), 15 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 1c75810d9e8..439464c2d98 100755
--- a/configure
+++ b/configure
@@ -17591,13 +17591,7 @@ fi
ac_fn_c_check_func "$LINENO" "dup" "ac_cv_func_dup"
if test "x$ac_cv_func_dup" = xyes
then :
- printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-
-fi
-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
+ printf '%s\n' "#define HAVE_DUP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "execv" "ac_cv_func_execv"
@@ -18067,12 +18061,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -18647,6 +18635,25 @@ fi
fi
+# 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" != "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
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
if test ${ac_cv_c_undeclared_builtin_options+y}
diff --git a/configure.ac b/configure.ac
index d0d54050286..94b624b3e0c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4896,7 +4896,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid getentropy geteuid getgid getgrgid getgrgid_r \
@@ -4906,7 +4906,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
pread preadv preadv2 pthread_condattr_setclock pthread_init pthread_kill \
pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
rtpSpawn sched_get_priority_max sched_rr_get_interval sched_setaffinity \
@@ -4928,6 +4928,13 @@ if test "$MACHDEP" != linux; then
AC_CHECK_FUNCS([lchmod])
fi
+# 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" != "Darwin"; then
+ AC_CHECK_FUNCS([dup3 pipe2])
+fi
+
AC_CHECK_DECL([dirfd],
[AC_DEFINE([HAVE_DIRFD], [1],
[Define if you have the 'dirfd' function or macro.])],
--
2.55.0.windows.3

View File

@ -0,0 +1,119 @@
From d92ec3351dd6a0cc2e2fe10bae23ffdb817de42d Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 10:30:17 +0300
Subject: [PATCH] (downstream) [3.12] gh-153711: Avoid use of dup3 and pipe2
calls introduced in macOS 27 (#155211)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 33 +++++++++++--------
configure.ac | 11 +++++--
3 files changed, 32 insertions(+), 15 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 241cf8f3d4a..62575e79243 100755
--- a/configure
+++ b/configure
@@ -17594,13 +17594,7 @@ fi
ac_fn_c_check_func "$LINENO" "dup" "ac_cv_func_dup"
if test "x$ac_cv_func_dup" = xyes
then :
- printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-
-fi
-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
+ printf '%s\n' "#define HAVE_DUP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "execv" "ac_cv_func_execv"
@@ -18070,12 +18064,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -18650,6 +18638,25 @@ fi
fi
+# 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" != "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
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
if test ${ac_cv_c_undeclared_builtin_options+y}
diff --git a/configure.ac b/configure.ac
index 9270b5f7172..7225a26752e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4899,7 +4899,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid getentropy geteuid getgid getgrgid getgrgid_r \
@@ -4909,7 +4909,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
pread preadv preadv2 pthread_condattr_setclock pthread_init pthread_kill \
pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
rtpSpawn sched_get_priority_max sched_rr_get_interval sched_setaffinity \
@@ -4931,6 +4931,13 @@ if test "$MACHDEP" != linux; then
AC_CHECK_FUNCS([lchmod])
fi
+# 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" != "Darwin"; then
+ AC_CHECK_FUNCS([dup3 pipe2])
+fi
+
AC_CHECK_DECL([dirfd],
[AC_DEFINE([HAVE_DIRFD], [1],
[Define if you have the 'dirfd' function or macro.])],
--
2.55.0.windows.3

View File

@ -0,0 +1,119 @@
From 99908afd676839023dd45807502e0018e3347268 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 10:30:17 +0300
Subject: [PATCH] (downstream) [3.12] gh-153711: Avoid use of dup3 and pipe2
calls introduced in macOS 27 (#155211)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 33 +++++++++++--------
configure.ac | 11 +++++--
3 files changed, 32 insertions(+), 15 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 89edc42f45c..e099c5ad55a 100755
--- a/configure
+++ b/configure
@@ -17614,13 +17614,7 @@ fi
ac_fn_c_check_func "$LINENO" "dup" "ac_cv_func_dup"
if test "x$ac_cv_func_dup" = xyes
then :
- printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-
-fi
-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
+ printf '%s\n' "#define HAVE_DUP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "execv" "ac_cv_func_execv"
@@ -18090,12 +18084,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -18670,6 +18658,25 @@ fi
fi
+# 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" != "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
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
if test ${ac_cv_c_undeclared_builtin_options+y}
diff --git a/configure.ac b/configure.ac
index 1a02d19f1b2..f2b58421d74 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4920,7 +4920,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid getentropy geteuid getgid getgrgid getgrgid_r \
@@ -4930,7 +4930,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_spawn posix_spawnp \
pread preadv preadv2 pthread_condattr_setclock pthread_init pthread_kill \
pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
rtpSpawn sched_get_priority_max sched_rr_get_interval sched_setaffinity \
@@ -4952,6 +4952,13 @@ if test "$MACHDEP" != linux; then
AC_CHECK_FUNCS([lchmod])
fi
+# 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" != "Darwin"; then
+ AC_CHECK_FUNCS([dup3 pipe2])
+fi
+
AC_CHECK_DECL([dirfd],
[AC_DEFINE([HAVE_DIRFD], [1],
[Define if you have the 'dirfd' function or macro.])],
--
2.55.0.windows.3

View File

@ -0,0 +1,105 @@
From 8d6715d85ad670ddfc69dbfffc8c03ac2ce166eb Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:20 +0800
Subject: [PATCH] [3.13] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150448)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index 7cdd386c387..e85f3f0ea3d 100755
--- a/configure
+++ b/configure
@@ -17953,12 +17953,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -18427,12 +18421,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -19048,7 +19036,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -19059,6 +19053,12 @@ 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
diff --git a/configure.ac b/configure.ac
index 24e28a1e2de..25b0587ec12 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5088,7 +5088,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5098,7 +5098,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
pthread_kill ptsname ptsname_r pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
@@ -5126,7 +5126,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,103 @@
From 0a97b1ca8dc1e5d689edbd87591962ba93c21db6 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:30:17 -0700
Subject: [PATCH] [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.
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 e85f3f0ea3d..3b63517ddfb 100755
--- a/configure
+++ b/configure
@@ -19036,13 +19036,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
@@ -19053,12 +19047,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
@@ -19067,6 +19055,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 25b0587ec12..d4e233e24a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5126,7 +5126,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],
--
2.55.0.windows.3

View File

@ -0,0 +1 @@
3.13.0

View File

@ -0,0 +1,105 @@
From 389f221839f2b21fb8ce5faa50f97d7d6592394c Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:20 +0800
Subject: [PATCH] [3.13] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150448)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index ae70f02f70e..4c3965e3a62 100755
--- a/configure
+++ b/configure
@@ -17956,12 +17956,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -18430,12 +18424,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -19051,7 +19039,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -19062,6 +19056,12 @@ 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
diff --git a/configure.ac b/configure.ac
index a764028e49f..1035134c48e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5091,7 +5091,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5101,7 +5101,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
pthread_kill ptsname ptsname_r pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
@@ -5129,7 +5129,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,103 @@
From 262ca735e924a4dfc93573c72a723c221a540aba Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:30:17 -0700
Subject: [PATCH] [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.
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 4c3965e3a62..b8ba6a16c81 100755
--- a/configure
+++ b/configure
@@ -19039,13 +19039,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
@@ -19056,12 +19050,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
@@ -19070,6 +19058,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 1035134c48e..2b6f37482d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5129,7 +5129,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],
--
2.55.0.windows.3

View File

@ -0,0 +1,105 @@
From ab182dfdeff041b61fbd36c3c11433bfdfbcaa1e Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:20 +0800
Subject: [PATCH] [3.13] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150448)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index 901a26c9602..4ade7c21754 100755
--- a/configure
+++ b/configure
@@ -18191,12 +18191,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -18671,12 +18665,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -19292,7 +19280,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -19303,6 +19297,12 @@ 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
diff --git a/configure.ac b/configure.ac
index 597a44b331a..6ffcb8694d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5217,7 +5217,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5227,7 +5227,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
pthread_kill ptsname ptsname_r pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
@@ -5255,7 +5255,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,103 @@
From 1f505104c4c968b8f4478cf97c50ea2129e12a66 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:30:17 -0700
Subject: [PATCH] [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.
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 4ade7c21754..6fd245e4c3b 100755
--- a/configure
+++ b/configure
@@ -19280,13 +19280,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
@@ -19297,12 +19291,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
@@ -19311,6 +19299,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 6ffcb8694d4..f75d0ff02ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5255,7 +5255,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],
--
2.55.0.windows.3

View File

@ -0,0 +1 @@
3.13.10

View File

@ -0,0 +1,105 @@
From dafe995d585cebef41da426be559e595134c5da9 Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:20 +0800
Subject: [PATCH] [3.13] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150448)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index 901a26c9602..4ade7c21754 100755
--- a/configure
+++ b/configure
@@ -18191,12 +18191,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -18671,12 +18665,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -19292,7 +19280,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -19303,6 +19297,12 @@ 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
diff --git a/configure.ac b/configure.ac
index 597a44b331a..6ffcb8694d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5217,7 +5217,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5227,7 +5227,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
pthread_kill ptsname ptsname_r pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
@@ -5255,7 +5255,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,103 @@
From c76e73a290159e530499f89addff8e0befc8230d Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:30:17 -0700
Subject: [PATCH] [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.
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 4ade7c21754..6fd245e4c3b 100755
--- a/configure
+++ b/configure
@@ -19280,13 +19280,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
@@ -19297,12 +19291,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
@@ -19311,6 +19299,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 6ffcb8694d4..f75d0ff02ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5255,7 +5255,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],
--
2.55.0.windows.3

View File

@ -0,0 +1 @@
3.13.11

View File

@ -0,0 +1,105 @@
From 91483b88e099ef9d4c2f3e1db1a370491120c93d Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:20 +0800
Subject: [PATCH] [3.13] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150448)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index 49b6795703a..95c9f306baa 100755
--- a/configure
+++ b/configure
@@ -18191,12 +18191,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -18671,12 +18665,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -19292,7 +19280,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -19303,6 +19297,12 @@ 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
diff --git a/configure.ac b/configure.ac
index 94776540d1b..747c630c329 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5217,7 +5217,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5227,7 +5227,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
pthread_kill ptsname ptsname_r pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
@@ -5255,7 +5255,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,103 @@
From 53b2f0d288f7f5b91c45da11aa9246ecab6b8f95 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:30:17 -0700
Subject: [PATCH] [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.
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 95c9f306baa..317191ae0f8 100755
--- a/configure
+++ b/configure
@@ -19280,13 +19280,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
@@ -19297,12 +19291,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
@@ -19311,6 +19299,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 747c630c329..d3173900340 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5255,7 +5255,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],
--
2.55.0.windows.3

View File

@ -0,0 +1 @@
3.13.12

View File

@ -0,0 +1,105 @@
From 211716524135a5c5b322540ec19ca4f5ae6abdbc Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:20 +0800
Subject: [PATCH] [3.13] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150448)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index 9ddb712b534..ff4eedd4df9 100755
--- a/configure
+++ b/configure
@@ -18228,12 +18228,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -18708,12 +18702,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -19329,7 +19317,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -19340,6 +19334,12 @@ 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
diff --git a/configure.ac b/configure.ac
index d9acfce793e..0c20b4f2dc0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5220,7 +5220,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5230,7 +5230,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
pthread_kill ptsname ptsname_r pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
@@ -5258,7 +5258,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,103 @@
From 2ffa77601e05d7c515edfb16ba6c2277675cb684 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:30:17 -0700
Subject: [PATCH] [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.
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 ff4eedd4df9..099b552e763 100755
--- a/configure
+++ b/configure
@@ -19317,13 +19317,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
@@ -19334,12 +19328,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
@@ -19348,6 +19336,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 0c20b4f2dc0..3e792193278 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5258,7 +5258,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],
--
2.55.0.windows.3

View File

@ -0,0 +1 @@
3.13.13

View File

@ -0,0 +1,103 @@
From 690e11097e2d313513a354ffbb0517866e201831 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:30:17 -0700
Subject: [PATCH] [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.
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 0df47513085..59d67626ad6 100755
--- a/configure
+++ b/configure
@@ -19368,13 +19368,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
@@ -19385,12 +19379,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
@@ -19399,6 +19387,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 a016a439c6c..c4d1e59a5e3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5280,7 +5280,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],
--
2.55.0.windows.3

View File

@ -0,0 +1 @@
3.13.14

View File

@ -0,0 +1 @@
3.13.1

View File

@ -0,0 +1,105 @@
From 72c96d07c449da15ef88369a1b4ea9ac3a76b5b5 Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:20 +0800
Subject: [PATCH] [3.13] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150448)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index 1cd1f690f7b..8c6a9648485 100755
--- a/configure
+++ b/configure
@@ -17976,12 +17976,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -18450,12 +18444,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -19071,7 +19059,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -19082,6 +19076,12 @@ 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
diff --git a/configure.ac b/configure.ac
index 3fcb18922c5..09223e4d2f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5112,7 +5112,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5122,7 +5122,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
pthread_kill ptsname ptsname_r pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
@@ -5150,7 +5150,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,103 @@
From 42d1ab9db0112d76647402436bfc69251b844536 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:30:17 -0700
Subject: [PATCH] [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.
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 8c6a9648485..3c4c3584a4a 100755
--- a/configure
+++ b/configure
@@ -19059,13 +19059,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
@@ -19076,12 +19070,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
@@ -19090,6 +19078,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 09223e4d2f0..c48de4ecc12 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5150,7 +5150,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],
--
2.55.0.windows.3

View File

@ -0,0 +1 @@
3.13.2

View File

@ -0,0 +1,105 @@
From dbadbc64aefb216fb54c5a751c6870976ad473d9 Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:20 +0800
Subject: [PATCH] [3.13] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150448)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index 1cd1f690f7b..8c6a9648485 100755
--- a/configure
+++ b/configure
@@ -17976,12 +17976,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -18450,12 +18444,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -19071,7 +19059,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -19082,6 +19076,12 @@ 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
diff --git a/configure.ac b/configure.ac
index 3fcb18922c5..09223e4d2f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5112,7 +5112,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5122,7 +5122,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
pthread_kill ptsname ptsname_r pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
@@ -5150,7 +5150,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,103 @@
From da3966ecc33d03d3cabacaa5af11fbf933c9d135 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:30:17 -0700
Subject: [PATCH] [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.
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 8c6a9648485..3c4c3584a4a 100755
--- a/configure
+++ b/configure
@@ -19059,13 +19059,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
@@ -19076,12 +19070,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
@@ -19090,6 +19078,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 09223e4d2f0..c48de4ecc12 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5150,7 +5150,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],
--
2.55.0.windows.3

View File

@ -0,0 +1 @@
3.13.3

View File

@ -0,0 +1,105 @@
From 7707acff006c594de6216d9c911017e7ca44a4c1 Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:20 +0800
Subject: [PATCH] [3.13] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150448)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index 1cd1f690f7b..8c6a9648485 100755
--- a/configure
+++ b/configure
@@ -17976,12 +17976,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -18450,12 +18444,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -19071,7 +19059,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -19082,6 +19076,12 @@ 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
diff --git a/configure.ac b/configure.ac
index 3fcb18922c5..09223e4d2f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5112,7 +5112,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5122,7 +5122,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
pthread_kill ptsname ptsname_r pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
@@ -5150,7 +5150,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,103 @@
From eb84f748e1b9f2953d534a4eaaa562ed80968d2d Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:30:17 -0700
Subject: [PATCH] [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.
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 8c6a9648485..3c4c3584a4a 100755
--- a/configure
+++ b/configure
@@ -19059,13 +19059,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
@@ -19076,12 +19070,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
@@ -19090,6 +19078,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 09223e4d2f0..c48de4ecc12 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5150,7 +5150,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],
--
2.55.0.windows.3

View File

@ -0,0 +1 @@
3.13.4

View File

@ -0,0 +1,105 @@
From edfd8c357cabbb59e3d2db9ab7b6eb1f2eff80fe Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:20 +0800
Subject: [PATCH] [3.13] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150448)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index 519caa8ca74..f19e43c8573 100755
--- a/configure
+++ b/configure
@@ -17976,12 +17976,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -18456,12 +18450,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -19077,7 +19065,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -19088,6 +19082,12 @@ 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
diff --git a/configure.ac b/configure.ac
index 2a037569e49..ce6625a752c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5112,7 +5112,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5122,7 +5122,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
pthread_kill ptsname ptsname_r pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
@@ -5150,7 +5150,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,103 @@
From 972a7e832fa8941b6ed92d366175748fd2172639 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:30:17 -0700
Subject: [PATCH] [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.
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 f19e43c8573..89f394a998b 100755
--- a/configure
+++ b/configure
@@ -19065,13 +19065,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
@@ -19082,12 +19076,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
@@ -19096,6 +19084,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 ce6625a752c..3abe99594c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5150,7 +5150,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],
--
2.55.0.windows.3

View File

@ -0,0 +1 @@
3.13.5

View File

@ -0,0 +1,105 @@
From 583757a560f95d29d4a8078dd1bcbdf3c3de1678 Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:20 +0800
Subject: [PATCH] [3.13] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150448)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index 901a26c9602..4ade7c21754 100755
--- a/configure
+++ b/configure
@@ -18191,12 +18191,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -18671,12 +18665,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -19292,7 +19280,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -19303,6 +19297,12 @@ 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
diff --git a/configure.ac b/configure.ac
index 597a44b331a..6ffcb8694d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5217,7 +5217,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5227,7 +5227,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
pthread_kill ptsname ptsname_r pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
@@ -5255,7 +5255,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,103 @@
From 8d221378537d08de2a43e1cbfcfbdf7a5613292b Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:30:17 -0700
Subject: [PATCH] [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.
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 4ade7c21754..6fd245e4c3b 100755
--- a/configure
+++ b/configure
@@ -19280,13 +19280,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
@@ -19297,12 +19291,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
@@ -19311,6 +19299,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 6ffcb8694d4..f75d0ff02ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5255,7 +5255,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],
--
2.55.0.windows.3

View File

@ -0,0 +1 @@
3.13.6

View File

@ -0,0 +1,105 @@
From fd99fe3b35195f34b00d0ba0ca8c26958e28fed4 Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:20 +0800
Subject: [PATCH] [3.13] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150448)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index 901a26c9602..4ade7c21754 100755
--- a/configure
+++ b/configure
@@ -18191,12 +18191,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -18671,12 +18665,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -19292,7 +19280,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -19303,6 +19297,12 @@ 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
diff --git a/configure.ac b/configure.ac
index 597a44b331a..6ffcb8694d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5217,7 +5217,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5227,7 +5227,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
pthread_kill ptsname ptsname_r pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
@@ -5255,7 +5255,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,103 @@
From f8dd6d4a22e74635cb2e1e7e8ad47033f06a4946 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:30:17 -0700
Subject: [PATCH] [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.
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 4ade7c21754..6fd245e4c3b 100755
--- a/configure
+++ b/configure
@@ -19280,13 +19280,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
@@ -19297,12 +19291,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
@@ -19311,6 +19299,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 6ffcb8694d4..f75d0ff02ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5255,7 +5255,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],
--
2.55.0.windows.3

View File

@ -0,0 +1 @@
3.13.7

View File

@ -0,0 +1,105 @@
From 8f7c908415d76ab2e71f6bc6479c912c1ba99bd2 Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:20 +0800
Subject: [PATCH] [3.13] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150448)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index 901a26c9602..4ade7c21754 100755
--- a/configure
+++ b/configure
@@ -18191,12 +18191,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -18671,12 +18665,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -19292,7 +19280,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -19303,6 +19297,12 @@ 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
diff --git a/configure.ac b/configure.ac
index 597a44b331a..6ffcb8694d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5217,7 +5217,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5227,7 +5227,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
pthread_kill ptsname ptsname_r pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
@@ -5255,7 +5255,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,103 @@
From c706d5d58dc4f620b665258946f86d0f48ad39f8 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:30:17 -0700
Subject: [PATCH] [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.
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 4ade7c21754..6fd245e4c3b 100755
--- a/configure
+++ b/configure
@@ -19280,13 +19280,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
@@ -19297,12 +19291,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
@@ -19311,6 +19299,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 6ffcb8694d4..f75d0ff02ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5255,7 +5255,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],
--
2.55.0.windows.3

View File

@ -0,0 +1 @@
3.13.8

View File

@ -0,0 +1,105 @@
From b0c32c8d11e63c3cc6f8741e3362e67965b5e446 Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:20 +0800
Subject: [PATCH] [3.13] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150448)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index 901a26c9602..4ade7c21754 100755
--- a/configure
+++ b/configure
@@ -18191,12 +18191,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -18671,12 +18665,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -19292,7 +19280,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -19303,6 +19297,12 @@ 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
diff --git a/configure.ac b/configure.ac
index 597a44b331a..6ffcb8694d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5217,7 +5217,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5227,7 +5227,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
pthread_kill ptsname ptsname_r pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \
@@ -5255,7 +5255,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,103 @@
From 3fc7c23cce6b846952067df633f113510a83e2c3 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:30:17 -0700
Subject: [PATCH] [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.
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 4ade7c21754..6fd245e4c3b 100755
--- a/configure
+++ b/configure
@@ -19280,13 +19280,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
@@ -19297,12 +19291,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
@@ -19311,6 +19299,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 6ffcb8694d4..f75d0ff02ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5255,7 +5255,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],
--
2.55.0.windows.3

View File

@ -0,0 +1 @@
3.13.9

View File

@ -0,0 +1,105 @@
From bf2d8d5a2c8fd2e0c5b4368ea7180c57971bc156 Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:16 +0800
Subject: [PATCH] [3.14] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150447)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index d31c24dffa2..29190f296af 100755
--- a/configure
+++ b/configure
@@ -19250,12 +19250,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -19730,12 +19724,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -20381,7 +20369,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -20392,6 +20386,12 @@ 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
diff --git a/configure.ac b/configure.ac
index af7a9623d7b..4c5bf12cc50 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5214,7 +5214,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dladdr dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dladdr dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5224,7 +5224,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv \
pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
@@ -5255,7 +5255,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,101 @@
From b871bbe60698c7a6bb6409cf4c091088e119eeb3 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:27:28 -0700
Subject: [PATCH] [3.14] gh-153711: Avoid use of dup3 and pipe2 calls
introduced in macOS 27 (#155206)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 29190f296af..2217e59d15f 100755
--- a/configure
+++ b/configure
@@ -20369,13 +20369,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
@@ -20386,12 +20380,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
@@ -20400,6 +20388,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 4c5bf12cc50..4ad84af4d17 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5255,7 +5255,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],
--
2.55.0.windows.3

View File

@ -0,0 +1,105 @@
From bc2b13dee7629b9c86dc53106311fe26de1a98a5 Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:16 +0800
Subject: [PATCH] [3.14] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150447)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index 46eb0665bf4..3f138a8ff11 100755
--- a/configure
+++ b/configure
@@ -19281,12 +19281,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -19761,12 +19755,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -20412,7 +20400,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -20423,6 +20417,12 @@ 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
diff --git a/configure.ac b/configure.ac
index bd4446e9488..9fdb671d44d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5239,7 +5239,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dladdr dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dladdr dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5249,7 +5249,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv \
pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
@@ -5280,7 +5280,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,101 @@
From 2d7a52cf26a57b14fde53897d782db55e63fb356 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:27:28 -0700
Subject: [PATCH] [3.14] gh-153711: Avoid use of dup3 and pipe2 calls
introduced in macOS 27 (#155206)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 3f138a8ff11..e38f8d8ab32 100755
--- a/configure
+++ b/configure
@@ -20400,13 +20400,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
@@ -20417,12 +20411,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
@@ -20431,6 +20419,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 9fdb671d44d..9e301b6ce6e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5280,7 +5280,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],
--
2.55.0.windows.3

View File

@ -0,0 +1,105 @@
From 5c927bf09aae2221636300e45187c27b8018766d Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:16 +0800
Subject: [PATCH] [3.14] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150447)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index 46eb0665bf4..3f138a8ff11 100755
--- a/configure
+++ b/configure
@@ -19281,12 +19281,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -19761,12 +19755,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -20412,7 +20400,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -20423,6 +20417,12 @@ 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
diff --git a/configure.ac b/configure.ac
index bd4446e9488..9fdb671d44d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5239,7 +5239,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dladdr dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dladdr dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5249,7 +5249,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv \
pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
@@ -5280,7 +5280,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,101 @@
From cb9757118e29df43276f01701e73fe50c57b1b25 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:27:28 -0700
Subject: [PATCH] [3.14] gh-153711: Avoid use of dup3 and pipe2 calls
introduced in macOS 27 (#155206)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 3f138a8ff11..e38f8d8ab32 100755
--- a/configure
+++ b/configure
@@ -20400,13 +20400,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
@@ -20417,12 +20411,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
@@ -20431,6 +20419,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 9fdb671d44d..9e301b6ce6e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5280,7 +5280,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],
--
2.55.0.windows.3

View File

@ -0,0 +1,105 @@
From 14dbab4f78b96ddc611b50558c50b548ae744032 Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:16 +0800
Subject: [PATCH] [3.14] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150447)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index 645628fecf2..2dae6dd38dc 100755
--- a/configure
+++ b/configure
@@ -19281,12 +19281,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -19761,12 +19755,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -20412,7 +20400,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -20423,6 +20417,12 @@ 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
diff --git a/configure.ac b/configure.ac
index d81c76fc122..20411ee381c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5239,7 +5239,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dladdr dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dladdr dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5249,7 +5249,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv \
pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
@@ -5280,7 +5280,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,101 @@
From 78204cc8e5beb318cee9bf831146bd339602c4c3 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:27:28 -0700
Subject: [PATCH] [3.14] gh-153711: Avoid use of dup3 and pipe2 calls
introduced in macOS 27 (#155206)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 2dae6dd38dc..74c9f7e0a3c 100755
--- a/configure
+++ b/configure
@@ -20400,13 +20400,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
@@ -20417,12 +20411,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
@@ -20431,6 +20419,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 20411ee381c..9c4fef6971e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5280,7 +5280,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],
--
2.55.0.windows.3

View File

@ -0,0 +1,105 @@
From 3ccb6c32cce56e55823dc406e2cdd8f33d588bba Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:16 +0800
Subject: [PATCH] [3.14] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150447)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index 8cfdda5a29b..c3e9474bbec 100755
--- a/configure
+++ b/configure
@@ -19321,12 +19321,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -19801,12 +19795,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -20452,7 +20440,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -20463,6 +20457,12 @@ 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
diff --git a/configure.ac b/configure.ac
index 1acb91fd27b..67128cc4ad0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5242,7 +5242,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dladdr dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dladdr dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5252,7 +5252,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv \
pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
@@ -5283,7 +5283,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,101 @@
From 0883623df9ba2ea83d2f9dc3031ac9d975824d98 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:27:28 -0700
Subject: [PATCH] [3.14] gh-153711: Avoid use of dup3 and pipe2 calls
introduced in macOS 27 (#155206)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 c3e9474bbec..89233599659 100755
--- a/configure
+++ b/configure
@@ -20440,13 +20440,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
@@ -20457,12 +20451,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
@@ -20471,6 +20459,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 67128cc4ad0..c004fce7770 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5283,7 +5283,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],
--
2.55.0.windows.3

View File

@ -0,0 +1,105 @@
From 972bdb3578e667c1fad1b09f3ec6355229c069cd Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Tue, 26 May 2026 13:07:16 +0800
Subject: [PATCH] [3.14] gh-150443: Exclude explicit dup3 and pipe2 checks on
iOS builds. (GH-150444) (#150447)
Exclude explicit dup3 and pipe2 checks on iOS builds.
(cherry picked from commit 629da5c914b4407e01c1dc06cbcbd8dce825fef3)
---
configure | 26 +++++++++++++-------------
configure.ac | 6 +++---
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index 30590a397f8..a5308e561aa 100755
--- a/configure
+++ b/configure
@@ -19375,12 +19375,6 @@ if test "x$ac_cv_func_dup" = xyes
then :
printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h
-fi
-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" "execv" "ac_cv_func_execv"
if test "x$ac_cv_func_execv" = xyes
@@ -19855,12 +19849,6 @@ if test "x$ac_cv_func_pipe" = xyes
then :
printf "%s\n" "#define HAVE_PIPE 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" "plock" "ac_cv_func_plock"
if test "x$ac_cv_func_plock" = xyes
@@ -20506,7 +20494,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_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+ 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"
if test "x$ac_cv_func_getentropy" = xyes
then :
printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
@@ -20517,6 +20511,12 @@ 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
diff --git a/configure.ac b/configure.ac
index 87c0ead45a6..4ff68cd36a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5264,7 +5264,7 @@ fi
# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
- copy_file_range ctermid dladdr dup dup3 execv explicit_bzero explicit_memset \
+ copy_file_range ctermid dladdr dup execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
@@ -5274,7 +5274,7 @@ AC_CHECK_FUNCS([ \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
lockf lstat lutimes madvise mbrtowc memrchr mkdirat mkfifo mkfifoat \
mknod mknodat mktime mmap mremap nice openat opendir pathconf pause pipe \
- pipe2 plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
+ plock poll posix_fadvise posix_fallocate posix_openpt posix_spawn posix_spawnp \
posix_spawn_file_actions_addclosefrom_np \
pread preadv preadv2 process_vm_readv \
pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
@@ -5305,7 +5305,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_CHECK_FUNCS([getentropy getgroups system])
+ AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
fi
AC_CHECK_DECL([dirfd],
--
2.55.0.windows.3

View File

@ -0,0 +1,101 @@
From d9fe3c8f79460f2ed5309b9fd667cfdc2a3a0462 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:27:28 -0700
Subject: [PATCH] [3.14] gh-153711: Avoid use of dup3 and pipe2 calls
introduced in macOS 27 (#155206)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 a5308e561aa..76ca500c68b 100755
--- a/configure
+++ b/configure
@@ -20494,13 +20494,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
@@ -20511,12 +20505,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
@@ -20525,6 +20513,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 4ff68cd36a5..b9f5217704f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5305,7 +5305,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],
--
2.55.0.windows.3

View File

@ -0,0 +1,101 @@
From 39bab3a49d6f952c55c036aef1872c7d6f701039 Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Wed, 5 Aug 2026 00:27:28 -0700
Subject: [PATCH] [3.14] gh-153711: Avoid use of dup3 and pipe2 calls
introduced in macOS 27 (#155206)
---
...-08-05-02-02-33.gh-issue-153711.pO9fFb.rst | 3 ++
configure | 32 +++++++++++--------
configure.ac | 8 ++++-
3 files changed, 29 insertions(+), 14 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2026-08-05-02-02-33.gh-issue-153711.pO9fFb.rst
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 00000000000..90804c179a4
--- /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 2088290f0ee..6d669963272 100755
--- a/configure
+++ b/configure
@@ -20494,13 +20494,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
@@ -20511,12 +20505,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
@@ -20525,6 +20513,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 aed14946731..900bf6215e0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5305,7 +5305,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],
--
2.55.0.windows.3

View File

@ -219,8 +219,10 @@ OUT
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010' stub sw_vers '-productVersion : echo 1010'
stub brew '--prefix openssl : false'
for i in {1..5}; do stub brew false; done for i in {1..5}; do stub brew false; done
stub brew "--prefix : echo '$BREW_PREFIX'" stub brew "--prefix : echo '$BREW_PREFIX'"
stub port '-q installed openssl3 : false' '-q installed openssl : false'
for i in {1..3}; do stub port false; done for i in {1..3}; do stub port false; done
stub_make_install stub_make_install
@ -253,6 +255,7 @@ OUT
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010' stub sw_vers '-productVersion : echo 1010'
stub brew '--prefix openssl : false'
for i in {1..5}; do stub brew false; done for i in {1..5}; do stub brew false; done
stub brew "--prefix : echo '$BREW_PREFIX'" stub brew "--prefix : echo '$BREW_PREFIX'"
stub_make_install stub_make_install
@ -282,6 +285,7 @@ OUT
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010' stub sw_vers '-productVersion : echo 1010'
stub port '-q installed openssl3 : false' '-q installed openssl : false'
for i in {1..3}; do stub port false; done for i in {1..3}; do stub port false; done
stub_make_install stub_make_install
export PYTHON_BUILD_SKIP_HOMEBREW=1 export PYTHON_BUILD_SKIP_HOMEBREW=1
@ -315,6 +319,7 @@ OUT
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010' stub sw_vers '-productVersion : echo 1010'
stub brew "--prefix libyaml : echo '$brew_libdir'" stub brew "--prefix libyaml : echo '$brew_libdir'"
stub brew '--prefix openssl : false'
for i in {1..6}; do stub brew false; done for i in {1..6}; do stub brew false; done
stub_make_install stub_make_install
@ -341,6 +346,7 @@ OUT
mkdir -p "$readline_libdir" mkdir -p "$readline_libdir"
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010' stub sw_vers '-productVersion : echo 1010'
stub brew '--prefix openssl : false'
for i in {1..2}; do stub brew false; done for i in {1..2}; do stub brew false; done
stub brew "--prefix readline : echo '$readline_libdir'" stub brew "--prefix readline : echo '$readline_libdir'"
for i in {1..3}; do stub brew false; done for i in {1..3}; do stub brew false; done
@ -371,6 +377,7 @@ OUT
mkdir -p "$ncurses_libdir" mkdir -p "$ncurses_libdir"
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010' stub sw_vers '-productVersion : echo 1010'
stub brew '--prefix openssl : false'
for i in {1..3}; do stub brew false; done for i in {1..3}; do stub brew false; done
stub brew "--prefix ncurses : echo '$ncurses_libdir'" stub brew "--prefix ncurses : echo '$ncurses_libdir'"
for i in {1..2}; do stub brew false; done for i in {1..2}; do stub brew false; done
@ -400,6 +407,7 @@ OUT
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010' stub sw_vers '-productVersion : echo 1010'
stub port "-q installed libyaml : echo ' libyaml @0.2.5_0 (active)'" stub port "-q installed libyaml : echo ' libyaml @0.2.5_0 (active)'"
stub port '-q installed openssl3 : false' '-q installed openssl : false'
for i in {1..3}; do stub port false; done for i in {1..3}; do stub port false; done
stub_make_install stub_make_install
export PYTHON_BUILD_SKIP_HOMEBREW=1 export PYTHON_BUILD_SKIP_HOMEBREW=1
@ -427,6 +435,7 @@ OUT
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010' stub sw_vers '-productVersion : echo 1010'
stub port '-q installed openssl3 : false' '-q installed openssl : false'
stub port "-q installed readline : echo ' readline @8.2.013_0 (active)'" stub port "-q installed readline : echo ' readline @8.2.013_0 (active)'"
for i in {1..2}; do stub port false; done for i in {1..2}; do stub port false; done
stub_make_install stub_make_install
@ -457,6 +466,7 @@ OUT
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010' stub sw_vers '-productVersion : echo 1010'
stub port '-q installed openssl3 : false' '-q installed openssl : false'
stub port false stub port false
stub port "-q installed ncurses : echo '$ncurses_libdir'" stub port "-q installed ncurses : echo '$ncurses_libdir'"
stub port false stub port false
@ -634,6 +644,7 @@ OUT
stub uname '-s : echo Linux' stub uname '-s : echo Linux'
stub brew false stub brew false
stub port '-q installed openssl3 : false' '-q installed openssl : false'
for i in {1..3}; do stub port false; done for i in {1..3}; do stub port false; done
PORT_PREFIX="$(which port)" PORT_PREFIX="$(which port)"
PORT_PREFIX="${PORT_PREFIX%/bin/port}" PORT_PREFIX="${PORT_PREFIX%/bin/port}"
@ -664,6 +675,7 @@ OUT
mkdir -p "$BREW_PREFIX" mkdir -p "$BREW_PREFIX"
stub uname '-s : echo Linux' stub uname '-s : echo Linux'
stub brew '--prefix openssl : false'
for i in {1..5}; do stub brew false; done for i in {1..5}; do stub brew false; done
stub brew "--prefix : echo '$BREW_PREFIX'" stub brew "--prefix : echo '$BREW_PREFIX'"
stub_make_install stub_make_install
@ -695,6 +707,7 @@ OUT
stub uname '-s : echo Linux' stub uname '-s : echo Linux'
stub brew "--prefix : echo '$BREW_PREFIX'" stub brew "--prefix : echo '$BREW_PREFIX'"
stub brew '--prefix openssl : false'
for i in {1..5}; do stub brew false; done for i in {1..5}; do stub brew false; done
stub brew "--prefix : echo '$BREW_PREFIX'" stub brew "--prefix : echo '$BREW_PREFIX'"
stub_make_install stub_make_install
@ -743,6 +756,218 @@ make install
OUT OUT
} }
assert_explicit_openssl() {
local configure_opts="$1"
local definition_opts="$2"
cached_tarball "Python-3.6.2"
local openssl_libdir="$BATS_TEST_TMPDIR/homebrew-openssl"
mkdir -p "$openssl_libdir"
executable "$BATS_TEST_TMPDIR/bin/brew" <<OUT
#!$BASH
if [ "\$*" = '--prefix openssl' ]; then
echo '$openssl_libdir'
else
exit 1
fi
OUT
stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010'
stub_make_install
export PYTHON_BUILD_SKIP_MACPORTS=1
run_inline_definition <<DEF
function /usr/bin/openssl() { echo "LibreSSL 3.3.6"; }
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL_RPATH=1
$definition_opts
install_package "openssl-1.1.1" "https://example.com/openssl-1.1.1.tar.gz" mac_openssl --if has_broken_mac_openssl
install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.gz"
DEF
assert_success
[[ "$output" != *"use openssl from homebrew"* ]]
unstub uname
unstub sw_vers
unstub make
assert_build_log <<OUT
Python-3.6.2: CFLAGS="" CPPFLAGS="-I${BATS_TEST_TMPDIR}/install/include" LDFLAGS="-L${BATS_TEST_TMPDIR}/install/lib -Wl,-rpath,${BATS_TEST_TMPDIR}/install/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib $configure_opts
make -j 2
make install
OUT
}
@test "explicit OpenSSL in CONFIGURE_OPTS bypasses automatic selection" {
export CONFIGURE_OPTS="--with-openssl=$BATS_TEST_TMPDIR/custom-openssl"
assert_explicit_openssl "$CONFIGURE_OPTS"
}
@test "explicit OpenSSL in PYTHON_CONFIGURE_OPTS bypasses automatic selection" {
export PYTHON_CONFIGURE_OPTS="--with-openssl=$BATS_TEST_TMPDIR/custom-openssl"
assert_explicit_openssl "$PYTHON_CONFIGURE_OPTS"
}
@test "explicit OpenSSL with a separate argument bypasses automatic selection" {
export PYTHON_CONFIGURE_OPTS="--with-openssl $BATS_TEST_TMPDIR/custom-openssl"
assert_explicit_openssl "$PYTHON_CONFIGURE_OPTS"
}
@test "explicit OpenSSL in package options bypasses automatic selection" {
local openssl_libdir="$BATS_TEST_TMPDIR/custom openssl"
assert_explicit_openssl "--with-openssl=$openssl_libdir" \
"package_option python configure '--with-openssl=$openssl_libdir'"
}
assert_standard_build_openssl_selection() {
local manager="$1"
local expected_opts="$2"
local definition_opts="$3"
local preceding_check="$4"
local expected_searches="${5:-0}"
local openssl_libdir="$BATS_TEST_TMPDIR/automatic-openssl"
cached_tarball "Python-3.6.2"
mkdir -p "$openssl_libdir"
executable "$BATS_TEST_TMPDIR/bin/brew" <<OUT
#!$BASH
if [ "\$*" = '--prefix openssl' ]; then
echo called >> '$BATS_TEST_TMPDIR/openssl-search'
echo '$openssl_libdir'
else
exit 1
fi
OUT
executable "$BATS_TEST_TMPDIR/bin/port" <<OUT
#!$BASH
if [ "\$*" = '-q installed openssl3' ]; then
echo called >> '$BATS_TEST_TMPDIR/openssl-search'
echo 'openssl3 @3.0.0 (active)'
else
exit 1
fi
OUT
if [ "$manager" = homebrew ]; then
export PYTHON_BUILD_USE_HOMEBREW=1
export PYTHON_BUILD_SKIP_MACPORTS=1
else
export PYTHON_BUILD_SKIP_HOMEBREW=1
export PYTHON_BUILD_USE_MACPORTS=1
fi
stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010'
stub_make_install
run_inline_definition <<DEF
function /usr/bin/openssl() { echo "LibreSSL 3.3.6"; }
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
$definition_opts
$preceding_check
install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.gz"
DEF
assert_success
unstub uname
unstub sw_vers
unstub make
run cat "$INSTALL_ROOT/build.log"
assert_output_contains "Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib $expected_opts"
if [ "$expected_searches" -eq 0 ]; then
refute test -e "$BATS_TEST_TMPDIR/openssl-search"
else
run cat "$BATS_TEST_TMPDIR/openssl-search"
assert_success "called"
fi
}
@test "explicit OpenSSL bypasses Homebrew selection in a standard build" {
export CONFIGURE_OPTS="--with-openssl=$BATS_TEST_TMPDIR/custom-openssl"
assert_standard_build_openssl_selection homebrew "$CONFIGURE_OPTS"
}
@test "explicit OpenSSL bypasses MacPorts selection in a standard build" {
export PYTHON_CONFIGURE_OPTS="--with-openssl $BATS_TEST_TMPDIR/custom-openssl"
assert_standard_build_openssl_selection macports "$PYTHON_CONFIGURE_OPTS"
}
@test "explicit package OpenSSL bypasses repeated Homebrew selection" {
local configure_opts="--with-openssl=$BATS_TEST_TMPDIR/custom openssl"
assert_standard_build_openssl_selection homebrew "$configure_opts" \
"package_option python configure '$configure_opts'" \
'has_broken_mac_openssl || true'
}
@test "explicit package OpenSSL bypasses repeated MacPorts selection" {
local configure_opts="--with-openssl=$BATS_TEST_TMPDIR/custom openssl"
assert_standard_build_openssl_selection macports "$configure_opts" \
"package_option python configure '$configure_opts'" \
'has_broken_mac_openssl || true'
}
@test "standard build selects Homebrew OpenSSL without a broken-system check" {
assert_standard_build_openssl_selection homebrew \
"--with-openssl=$BATS_TEST_TMPDIR/automatic-openssl" '' '' 1
}
@test "standard build selects MacPorts OpenSSL without a broken-system check" {
assert_standard_build_openssl_selection macports \
"--with-openssl=$BATS_TEST_TMPDIR" '' '' 1
}
@test "standard build does not probe Homebrew OpenSSL again after selection" {
assert_standard_build_openssl_selection homebrew \
"--with-openssl=$BATS_TEST_TMPDIR/automatic-openssl" '' \
'has_broken_mac_openssl || true' 1
}
@test "standard build does not probe MacPorts OpenSSL again after selection" {
assert_standard_build_openssl_selection macports \
"--with-openssl=$BATS_TEST_TMPDIR" '' \
'has_broken_mac_openssl || true' 1
}
@test "OpenSSL rpath alone does not bypass Homebrew selection" {
local openssl_libdir="$BATS_TEST_TMPDIR/homebrew-openssl"
mkdir -p "$openssl_libdir"
stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010'
stub brew "--prefix openssl : echo '$openssl_libdir'"
export PYTHON_CONFIGURE_OPTS="--with-openssl-rpath=auto"
run_inline_definition <<'DEF'
function /usr/bin/openssl() { echo "LibreSSL 3.3.6"; }
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
has_broken_mac_openssl || true
printf '%s\n' "${PYTHON_CONFIGURE_OPTS_ARRAY[@]}"
DEF
assert_success
assert_output <<OUT
python-build: use openssl from homebrew
--enable-shared
--libdir=$INSTALL_ROOT/lib
--with-openssl=$openssl_libdir
OUT
unstub uname
unstub sw_vers
unstub brew
}
@test "bundled OpenSSL is still needed without an explicit or package-manager installation" {
stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010'
stub brew '--prefix openssl : false'
export PYTHON_BUILD_SKIP_MACPORTS=1
run_inline_definition <<'DEF'
function /usr/bin/openssl() { echo "LibreSSL 3.3.6"; }
has_broken_mac_openssl && echo "bundled OpenSSL needed"
DEF
assert_success "bundled OpenSSL needed"
unstub uname
unstub sw_vers
unstub brew
}
@test "readline is not linked from Homebrew when explicitly defined" { @test "readline is not linked from Homebrew when explicitly defined" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
@ -753,6 +978,7 @@ OUT
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010' stub sw_vers '-productVersion : echo 1010'
stub brew '--prefix openssl : false'
for i in {1..5}; do stub brew false; done for i in {1..5}; do stub brew false; done
stub_make_install stub_make_install
@ -782,6 +1008,7 @@ OUT
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010' stub sw_vers '-productVersion : echo 1010'
stub brew '--prefix openssl : false'
stub brew "--prefix tcl-tk@8 : echo '$tcl_tk_libdir'" stub brew "--prefix tcl-tk@8 : echo '$tcl_tk_libdir'"
for i in {1..4}; do stub brew false; done for i in {1..4}; do stub brew false; done
@ -815,6 +1042,7 @@ TCL_DEFS='-DSMTH -DTCL_WITH_EXTERNAL_TOMMATH=1 -DSMTH_ELSE'
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010' stub sw_vers '-productVersion : echo 1010'
stub brew '--prefix openssl : false'
stub brew "--prefix tcl-tk@8 : echo '$tcl_tk_libdir'" stub brew "--prefix tcl-tk@8 : echo '$tcl_tk_libdir'"
for i in {1..4}; do stub brew false; done for i in {1..4}; do stub brew false; done
@ -845,6 +1073,7 @@ OUT
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010' stub sw_vers '-productVersion : echo 1010'
stub brew '--prefix openssl : false'
stub brew "--prefix tcl-tk-custom : echo '$tcl_tk_libdir'" stub brew "--prefix tcl-tk-custom : echo '$tcl_tk_libdir'"
for i in {1..4}; do stub brew false; done for i in {1..4}; do stub brew false; done
@ -876,6 +1105,7 @@ OUT
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010' stub sw_vers '-productVersion : echo 1010'
stub brew '--prefix openssl : false'
stub brew "--prefix tcl-tk@8 : echo '$tcl_tk_libdir'" stub brew "--prefix tcl-tk@8 : echo '$tcl_tk_libdir'"
for i in {1..4}; do stub brew false; done for i in {1..4}; do stub brew false; done
@ -911,6 +1141,7 @@ TCL_DEFS='-DSMTH -DTCL_WITH_EXTERNAL_TOMMATH=1 -DSMTH_ELSE'
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010' stub sw_vers '-productVersion : echo 1010'
stub brew '--prefix openssl : false'
stub brew "--prefix tcl-tk@8 : echo '$tcl_tk_libdir'" stub brew "--prefix tcl-tk@8 : echo '$tcl_tk_libdir'"
for i in {1..4}; do stub brew false; done for i in {1..4}; do stub brew false; done
@ -946,6 +1177,7 @@ OUT
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010' stub sw_vers '-productVersion : echo 1010'
stub brew '--prefix openssl : false'
for i in {1..4}; do stub brew false; done for i in {1..4}; do stub brew false; done
stub_make_install stub_make_install
@ -977,6 +1209,7 @@ OUT
tcl_tk_libdir="$BATS_TEST_TMPDIR/homebrew-tcl-tk" tcl_tk_libdir="$BATS_TEST_TMPDIR/homebrew-tcl-tk"
mkdir -p "$tcl_tk_libdir/lib" mkdir -p "$tcl_tk_libdir/lib"
stub brew '--prefix openssl : false'
stub brew "--prefix tcl-tk@8 : echo '${tcl_tk_libdir}'" stub brew "--prefix tcl-tk@8 : echo '${tcl_tk_libdir}'"
for i in {1..4}; do stub brew false; done for i in {1..4}; do stub brew false; done
@ -1006,6 +1239,7 @@ OUT
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.10' stub sw_vers '-productVersion : echo 10.10'
stub brew '--prefix openssl : false'
for i in {1..6}; do stub brew false; done for i in {1..6}; do stub brew false; done
stub sysctl false stub sysctl false
@ -1035,6 +1269,7 @@ OUT
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.10' stub sw_vers '-productVersion : echo 10.10'
stub brew '--prefix openssl : false'
for i in {1..6}; do stub brew false; done for i in {1..6}; do stub brew false; done
stub sysctl '-n hw.ncpu : echo 4' stub sysctl '-n hw.ncpu : echo 4'
@ -1141,6 +1376,7 @@ OUT
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010' stub sw_vers '-productVersion : echo 1010'
stub brew '--prefix openssl : false'
for i in {1..6}; do stub brew false; done for i in {1..6}; do stub brew false; done
stub_make_install stub_make_install

View File

@ -0,0 +1,83 @@
#!/usr/bin/env bats
load test_helper
_setup() {
prerequisites="make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev curl git llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev \
liblzma-dev libzstd-dev"
}
@test "completion does not install packages" {
stub apt-get
PATH="${BATS_TEST_DIRNAME}/../../../libexec:$PATH" \
run pyenv completions install-prerequisites
assert_success "--help"
unstub apt-get
}
@test "supports help" {
stub pyenv-help 'install-prerequisites : echo "Usage: pyenv install-prerequisites"'
run pyenv-install-prerequisites --help
assert_success "Usage: pyenv install-prerequisites"
unstub pyenv-help
}
@test "rejects arguments" {
stub pyenv-help 'install-prerequisites : echo "Usage: pyenv install-prerequisites"'
run pyenv-install-prerequisites unexpected
assert_failure "Usage: pyenv install-prerequisites"
unstub pyenv-help
}
@test "installs build prerequisites with apt-get as root" {
stub id '-u : echo 0'
stub apt-get \
'update -q : true' \
"install -yq ${prerequisites} : true"
run pyenv-install-prerequisites
assert_success
unstub apt-get
unstub id
}
@test "uses sudo when not running as root" {
stub id '-u : echo 1000'
stub apt-get
stub sudo \
'apt-get update -q : true' \
"apt-get install -yq ${prerequisites} : true"
run pyenv-install-prerequisites
assert_success
unstub sudo
unstub apt-get
unstub id
}
@test "fails when apt-get is unavailable" {
PATH="$(path_without apt-get)" run pyenv-install-prerequisites
assert_failure "pyenv: installing build prerequisites is not supported on this system"
}
@test "fails when sudo is unavailable for an unprivileged user" {
stub id '-u : echo 1000'
stub apt-get
PATH="$(path_without sudo)" run pyenv-install-prerequisites
assert_failure "pyenv: sudo is required to install build prerequisites"
unstub apt-get
unstub id
}

View File

@ -2,6 +2,7 @@ setup() {
export PYTHON_BUILD_CURL_OPTS= export PYTHON_BUILD_CURL_OPTS=
export PYTHON_BUILD_HTTP_CLIENT="curl" export PYTHON_BUILD_HTTP_CLIENT="curl"
export PYENV_TEST_DIR="${BATS_TEST_TMPDIR}/pyenv"
export FIXTURE_ROOT="${BATS_TEST_DIRNAME}/fixtures" export FIXTURE_ROOT="${BATS_TEST_DIRNAME}/fixtures"
export INSTALL_ROOT="${BATS_TEST_TMPDIR}/install" export INSTALL_ROOT="${BATS_TEST_TMPDIR}/install"
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
@ -148,7 +149,7 @@ path_without() {
if [ "$found" != "${PYENV_ROOT}/shims" ]; then if [ "$found" != "${PYENV_ROOT}/shims" ]; then
alt="${PYENV_TEST_DIR}/$(echo "${found#/}" | tr '/' '-')" alt="${PYENV_TEST_DIR}/$(echo "${found#/}" | tr '/' '-')"
mkdir -p "$alt" mkdir -p "$alt"
for util in bash head cut readlink greadlink; do for util in bash head cut readlink greadlink tr; do
if [ -x "${found}/$util" ]; then if [ -x "${found}/$util" ]; then
ln -s "${found}/$util" "${alt}/$util" ln -s "${found}/$util" "${alt}/$util"
fi fi

View File

@ -12,7 +12,7 @@ FROM bash:$BASH
apk add sed coreutils findutils \ apk add sed coreutils findutils \
;fi ;fi
# Bats # Bats
RUN apk add --update parallel ncurses git binutils \ RUN apk add --update parallel ncurses git binutils xz \
&& mkdir -p ~/.parallel \ && mkdir -p ~/.parallel \
&& touch ~/.parallel/will-cite && touch ~/.parallel/will-cite
COPY --from=bats /root/bats-core /root/bats-core COPY --from=bats /root/bats-core /root/bats-core

View File

@ -2,8 +2,14 @@ unset PYENV_VERSION
unset PYENV_DIR unset PYENV_DIR
setup() { setup() {
export _PYENV_INSTALL_PREFIX="${BATS_TEST_DIRNAME%/*}"
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
export _PYENV_INSTALL_PREFIX="${BATS_TEST_DIRNAME%/*}"
local PLUGIN_PREFIX
if [[ $_PYENV_INSTALL_PREFIX =~ /plugins/[^/]+$ ]]; then
PLUGIN_PREFIX="$_PYENV_INSTALL_PREFIX"
_PYENV_INSTALL_PREFIX="${_PYENV_INSTALL_PREFIX::${#_PYENV_INSTALL_PREFIX}-${#BASH_REMATCH[0]}}"
fi
if ! enable -f "${_PYENV_INSTALL_PREFIX}"/libexec/pyenv-realpath.dylib realpath 2>/dev/null; then if ! enable -f "${_PYENV_INSTALL_PREFIX}"/libexec/pyenv-realpath.dylib realpath 2>/dev/null; then
if [ -n "$PYENV_NATIVE_EXT" ]; then if [ -n "$PYENV_NATIVE_EXT" ]; then
echo "pyenv: failed to load \`realpath' builtin" >&2 echo "pyenv: failed to load \`realpath' builtin" >&2
@ -27,6 +33,9 @@ setup() {
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
PATH="${PYENV_TEST_DIR}/bin:$PATH" PATH="${PYENV_TEST_DIR}/bin:$PATH"
PATH="${_PYENV_INSTALL_PREFIX}/libexec:$PATH" PATH="${_PYENV_INSTALL_PREFIX}/libexec:$PATH"
if [[ -n $PLUGIN_PREFIX ]]; then
PATH="${PLUGIN_PREFIX}/libexec:${PLUGIN_PREFIX}/bin:$PATH"
fi
PATH="${BATS_TEST_DIRNAME}/libexec:$PATH" PATH="${BATS_TEST_DIRNAME}/libexec:$PATH"
PATH="${PYENV_ROOT}/shims:$PATH" PATH="${PYENV_ROOT}/shims:$PATH"
PATH="${BATS_TEST_TMPDIR}/stubs:$PATH" PATH="${BATS_TEST_TMPDIR}/stubs:$PATH"
@ -40,6 +49,7 @@ setup() {
# even if its output is redirected, breaking the comparison logic # even if its output is redirected, breaking the comparison logic
export NO_COLOR=1 export NO_COLOR=1
# If test specific setup exist, run it # If test specific setup exist, run it
if [[ $(type -t _setup) == function ]];then if [[ $(type -t _setup) == function ]];then
_setup _setup