From 31d843c80441bfa879829bac368583f85ee0e96b Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 30 Mar 2026 10:36:19 +0200 Subject: [PATCH 1/2] gh-146444: Make Platforms/Apple/ compatible with Python 3.9 Replace "str | None" with typing.Union[str, None]. --- Platforms/Apple/__main__.py | 3 ++- Platforms/Apple/testbed/__main__.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Platforms/Apple/__main__.py b/Platforms/Apple/__main__.py index c646a222bc630f..9b51f8a3b75514 100644 --- a/Platforms/Apple/__main__.py +++ b/Platforms/Apple/__main__.py @@ -52,9 +52,10 @@ from os.path import basename, relpath from pathlib import Path from subprocess import CalledProcessError +from typing import Union EnvironmentT = dict[str, str] -ArgsT = Sequence[str | Path] +ArgsT = Sequence[Union[str, Path]] SCRIPT_NAME = Path(__file__).name PYTHON_DIR = Path(__file__).resolve().parent.parent.parent diff --git a/Platforms/Apple/testbed/__main__.py b/Platforms/Apple/testbed/__main__.py index 0dd77ab8b82797..96da1f9c7525f1 100644 --- a/Platforms/Apple/testbed/__main__.py +++ b/Platforms/Apple/testbed/__main__.py @@ -7,6 +7,7 @@ import subprocess import sys from pathlib import Path +from typing import Union TEST_SLICES = { "iOS": "ios-arm64_x86_64-simulator", @@ -262,7 +263,7 @@ def update_test_plan(testbed_path, platform, args): def run_testbed( platform: str, - simulator: str | None, + simulator: Union[str, None], args: list[str], verbose: bool = False, ): From 086ae1ee0caf282844fdcd1bfeb0384d3869ee03 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 30 Mar 2026 10:55:37 +0200 Subject: [PATCH 2/2] Use Python 3.9 --- Platforms/Apple/.ruff.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Platforms/Apple/.ruff.toml b/Platforms/Apple/.ruff.toml index f5d74fdb6afe87..a10de0edb804f4 100644 --- a/Platforms/Apple/.ruff.toml +++ b/Platforms/Apple/.ruff.toml @@ -1,5 +1,8 @@ extend = "../../.ruff.toml" # Inherit the project-wide settings +# iOS buildbot worker uses Python 3.9 +target-version = "py39" + [format] preview = true docstring-code-format = true