python / python/cpython

macOS: Test availability for dup3() and pipe2() to prevent crashes when building against Xcode 27

Open
#153,711 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

3.13 3.14 3.15 3.16 extension-modules OS-ios OS-mac type-crash
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Crash report

What happened?

This year's Apple OS releases (macOS/iOS/tvOS/watchOS/visionOS 27) add support for dup3() and pipe2(). When building for macOS using Xcode 27 beta but running on macOS 26, configure detects these functions, but Python crashes when it tries to use them. As a temporary fix, I'm passing ac_cv_func_dup3=no ac_cv_func_pipe2=no to configure. The real fix will be to use availability checks in Modules/posixmodule.c for dup3() and pipe2(), like gh-97897 does

Prototypes added to sys/unistd.h in the *27 SDK:

__API_AVAILABLE(macos(27.0), ios(27.0), tvos(27.0), watchos(27.0), visionos(27.0))
int     dup3(int, int, int);
__API_AVAILABLE(macos(27.0), ios(27.0), tvos(27.0), watchos(27.0), visionos(27.0))
int     pipe2(int [2], int);

@ned-deily @ronaldoussoren

CPython versions tested on:

3.13

Operating systems tested on:

macOS

Output from running 'python -VV' on the command line:

No response

Linked PRs
  • gh-154718
  • gh-155174
  • gh-155202
  • gh-155206
  • gh-155211
  • gh-155222

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read Modules/posixmodule.c and the availability-check precedent in gh-97897, then reproduce the Xcode 27/macOS 26 configure and build scenario described in the report. Done means dup3() and pipe2() are safely handled when building against the newer SDK but running on older macOS versions, with the relevant build or runtime checks passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, macos, python
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.