Skip to content

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

Description

@mrpippy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-crashA hard crash of the interpreter, possibly with a core dump

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions