Skip to content

Commit e3f1ddb

Browse files
authored
Merge branch 'python:main' into pyrepl-module-completion-check-for-already-imported-modules
2 parents 78e4737 + 35e9d41 commit e3f1ddb

File tree

268 files changed

+6710
-3747
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

268 files changed

+6710
-3747
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ Modules/makesetup @erlend-aasland @AA-Turner @emmatyping
8686
Modules/Setup* @erlend-aasland @AA-Turner @emmatyping
8787
Tools/build/regen-configure.sh @AA-Turner
8888

89+
# generate-build-details
90+
Tools/build/generate-build-details.py @FFY00
91+
Lib/test/test_build_details.py @FFY00
92+
8993

9094
# ----------------------------------------------------------------------------
9195
# Documentation

.github/actionlint.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
self-hosted-runner:
22
# Pending https://github.com/rhysd/actionlint/issues/533
3-
labels: ["windows-11-arm"]
3+
# and https://github.com/rhysd/actionlint/issues/571
4+
labels: ["windows-11-arm", "macos-15-intel"]
45

56
config-variables: null
67

.github/workflows/build.yml

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -202,24 +202,16 @@ jobs:
202202
strategy:
203203
fail-fast: false
204204
matrix:
205-
# Cirrus and macos-14 are M1, macos-13 is default GHA Intel.
206-
# macOS 13 only runs tests against the GIL-enabled CPython.
207-
# Cirrus used for upstream, macos-14 for forks.
205+
# macos-14 is M1, macos-15-intel is Intel.
206+
# macos-15-intel only runs tests against the GIL-enabled CPython.
208207
os:
209-
- ghcr.io/cirruslabs/macos-runner:sonoma
210208
- macos-14
211-
- macos-13
212-
is-fork: # only used for the exclusion trick
213-
- ${{ github.repository_owner != 'python' }}
209+
- macos-15-intel
214210
free-threading:
215211
- false
216212
- true
217213
exclude:
218-
- os: ghcr.io/cirruslabs/macos-runner:sonoma
219-
is-fork: true
220-
- os: macos-14
221-
is-fork: false
222-
- os: macos-13
214+
- os: macos-15-intel
223215
free-threading: true
224216
uses: ./.github/workflows/reusable-macos.yml
225217
with:
@@ -273,7 +265,7 @@ jobs:
273265
# Keep 1.1.1w in our list despite it being upstream EOL and otherwise
274266
# unsupported as it most resembles other 1.1.1-work-a-like ssl APIs
275267
# supported by important vendors such as AWS-LC.
276-
openssl_ver: [1.1.1w, 3.0.17, 3.2.5, 3.3.4, 3.4.2, 3.5.2]
268+
openssl_ver: [1.1.1w, 3.0.18, 3.2.6, 3.3.5, 3.4.3, 3.5.4]
277269
# See Tools/ssl/make_ssl_data.py for notes on adding a new version
278270
env:
279271
OPENSSL_VER: ${{ matrix.openssl_ver }}
@@ -409,9 +401,8 @@ jobs:
409401
fail-fast: false
410402
matrix:
411403
include:
412-
# Use the same runs-on configuration as build-macos and build-ubuntu.
413404
- arch: aarch64
414-
runs-on: ${{ github.repository_owner == 'python' && 'ghcr.io/cirruslabs/macos-runner:sonoma' || 'macos-14' }}
405+
runs-on: macos-14
415406
- arch: x86_64
416407
runs-on: ubuntu-24.04
417408

@@ -421,7 +412,7 @@ jobs:
421412
with:
422413
persist-credentials: false
423414
- name: Build and test
424-
run: ./Android/android.py ci ${{ matrix.arch }}-linux-android
415+
run: ./Android/android.py ci --fast-ci ${{ matrix.arch }}-linux-android
425416

426417
build-wasi:
427418
name: 'WASI'
@@ -438,7 +429,7 @@ jobs:
438429
needs: build-context
439430
if: needs.build-context.outputs.run-tests == 'true'
440431
env:
441-
OPENSSL_VER: 3.0.16
432+
OPENSSL_VER: 3.0.18
442433
PYTHONSTRICTEXTENSIONBUILD: 1
443434
steps:
444435
- uses: actions/checkout@v4
@@ -558,7 +549,7 @@ jobs:
558549
matrix:
559550
os: [ubuntu-24.04]
560551
env:
561-
OPENSSL_VER: 3.0.16
552+
OPENSSL_VER: 3.0.18
562553
PYTHONSTRICTEXTENSIONBUILD: 1
563554
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
564555
steps:

.github/workflows/jit.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
runner: windows-11-arm
8282
- target: x86_64-apple-darwin/clang
8383
architecture: x86_64
84-
runner: macos-13
84+
runner: macos-15-intel
8585
- target: aarch64-apple-darwin/clang
8686
architecture: aarch64
8787
runner: macos-14
@@ -106,15 +106,10 @@ jobs:
106106
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }}
107107
./PCbuild/rt.bat ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3
108108
109-
# The `find` line is required as a result of https://github.com/actions/runner-images/issues/9966.
110-
# This is a bug in the macOS runner image where the pre-installed Python is installed in the same
111-
# directory as the Homebrew Python, which causes the build to fail for macos-13. This line removes
112-
# the symlink to the pre-installed Python so that the Homebrew Python is used instead.
113109
- name: macOS
114110
if: runner.os == 'macOS'
115111
run: |
116112
brew update
117-
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
118113
brew install llvm@${{ matrix.llvm }}
119114
export SDKROOT="$(xcrun --show-sdk-path)"
120115
# Set MACOSX_DEPLOYMENT_TARGET and -Werror=unguarded-availability to

.github/workflows/project-updater.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/reusable-macos.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ jobs:
6060
--prefix=/opt/python-dev \
6161
--with-openssl="$(brew --prefix [email protected])"
6262
- name: Build CPython
63-
if : ${{ inputs.free-threading || inputs.os != 'macos-13' }}
63+
if : ${{ inputs.free-threading || inputs.os != 'macos-15-intel' }}
6464
run: gmake -j8
6565
- name: Build CPython for compiler warning check
66-
if : ${{ !inputs.free-threading && inputs.os == 'macos-13' }}
66+
if : ${{ !inputs.free-threading && inputs.os == 'macos-15-intel' }}
6767
run: set -o pipefail; gmake -j8 --output-sync 2>&1 | tee compiler_output_macos.txt
6868
- name: Display build info
6969
run: make pythoninfo
7070
- name: Check compiler warnings
71-
if : ${{ !inputs.free-threading && inputs.os == 'macos-13' }}
71+
if : ${{ !inputs.free-threading && inputs.os == 'macos-15-intel' }}
7272
run: >-
7373
python3 Tools/build/check_warnings.py
7474
--compiler-output-file-path=compiler_output_macos.txt

.github/workflows/reusable-ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
runs-on: ${{ inputs.os }}
3131
timeout-minutes: 60
3232
env:
33-
OPENSSL_VER: 3.0.15
33+
OPENSSL_VER: 3.0.18
3434
PYTHONSTRICTEXTENSIONBUILD: 1
3535
TERM: linux
3636
steps:

.github/workflows/tail-call.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
# runner: windows-2022
5959
- target: x86_64-apple-darwin/clang
6060
architecture: x86_64
61-
runner: macos-13
61+
runner: macos-15-intel
6262
- target: aarch64-apple-darwin/clang
6363
architecture: aarch64
6464
runner: macos-14
@@ -101,17 +101,10 @@ jobs:
101101
set LLVMInstallDir=C:\Program Files\LLVM
102102
./PCbuild/build.bat --tail-call-interp -p ${{ matrix.architecture }}
103103
104-
# The `find` line is required as a result of https://github.com/actions/runner-images/issues/9966.
105-
# This is a bug in the macOS runner image where the pre-installed Python is installed in the same
106-
# directory as the Homebrew Python, which causes the build to fail for macos-13. This line removes
107-
# the symlink to the pre-installed Python so that the Homebrew Python is used instead.
108-
# Note: when a new LLVM is released, the homebrew installation directory changes, so the builds will fail.
109-
# We either need to upgrade LLVM or change the directory being pointed to.
110104
- name: Native macOS (release)
111105
if: runner.os == 'macOS'
112106
run: |
113107
brew update
114-
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
115108
brew install llvm@${{ matrix.llvm }}
116109
export SDKROOT="$(xcrun --show-sdk-path)"
117110
export PATH="/usr/local/opt/llvm@${{ matrix.llvm }}/bin:$PATH"

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ repos:
2626
name: Run Ruff (lint) on Tools/peg_generator/
2727
args: [--exit-non-zero-on-fix, --config=Tools/peg_generator/.ruff.toml]
2828
files: ^Tools/peg_generator/
29+
- id: ruff-check
30+
name: Run Ruff (lint) on Tools/wasm/
31+
args: [--exit-non-zero-on-fix, --config=Tools/wasm/.ruff.toml]
32+
files: ^Tools/wasm/
2933
- id: ruff-format
3034
name: Run Ruff (format) on Doc/
3135
args: [--check]
@@ -34,6 +38,10 @@ repos:
3438
name: Run Ruff (format) on Tools/build/check_warnings.py
3539
args: [--check, --config=Tools/build/.ruff.toml]
3640
files: ^Tools/build/check_warnings.py
41+
- id: ruff-format
42+
name: Run Ruff (format) on Tools/wasm/
43+
args: [--check, --config=Tools/wasm/.ruff.toml]
44+
files: ^Tools/wasm/
3745

3846
- repo: https://github.com/psf/black-pre-commit-mirror
3947
rev: 25.9.0

Android/android.py

Lines changed: 49 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import asyncio
44
import argparse
5+
import json
56
import os
67
import platform
78
import re
@@ -184,10 +185,16 @@ def make_build_python(context):
184185
run(["make", "-j", str(os.cpu_count())])
185186

186187

188+
# To create new builds of these dependencies, usually all that's necessary is to
189+
# push a tag to the cpython-android-source-deps repository, and GitHub Actions
190+
# will do the rest.
191+
#
192+
# If you're a member of the Python core team, and you'd like to be able to push
193+
# these tags yourself, please contact Malcolm Smith or Russell Keith-Magee.
187194
def unpack_deps(host, prefix_dir):
188195
os.chdir(prefix_dir)
189196
deps_url = "https://github.com/beeware/cpython-android-source-deps/releases/download"
190-
for name_ver in ["bzip2-1.0.8-3", "libffi-3.4.4-3", "openssl-3.0.15-4",
197+
for name_ver in ["bzip2-1.0.8-3", "libffi-3.4.4-3", "openssl-3.0.18-0",
191198
"sqlite-3.50.4-0", "xz-5.4.6-1", "zstd-1.5.7-1"]:
192199
filename = f"{name_ver}-{host}.tar.gz"
193200
download(f"{deps_url}/{name_ver}/{filename}")
@@ -546,27 +553,33 @@ async def gradle_task(context):
546553
task_prefix = "connected"
547554
env["ANDROID_SERIAL"] = context.connected
548555

549-
if context.command:
550-
mode = "-c"
551-
module = context.command
552-
else:
553-
mode = "-m"
554-
module = context.module or "test"
556+
if context.ci_mode:
557+
context.args[0:0] = [
558+
# See _add_ci_python_opts in libregrtest/main.py.
559+
"-W", "error", "-bb", "-E",
560+
561+
# Randomization is disabled because order-dependent failures are
562+
# much less likely to pass on a rerun in single-process mode.
563+
"-m", "test",
564+
f"--{context.ci_mode}-ci", "--single-process", "--no-randomize"
565+
]
566+
567+
if not any(arg in context.args for arg in ["-c", "-m"]):
568+
context.args[0:0] = ["-m", "test"]
555569

556570
args = [
557571
gradlew, "--console", "plain", f"{task_prefix}DebugAndroidTest",
558572
] + [
559-
# Build-time properties
560-
f"-Ppython.{name}={value}"
561-
for name, value in [
562-
("sitePackages", context.site_packages), ("cwd", context.cwd)
563-
] if value
564-
] + [
565-
# Runtime properties
566-
f"-Pandroid.testInstrumentationRunnerArguments.python{name}={value}"
573+
f"-P{name}={value}"
567574
for name, value in [
568-
("Mode", mode), ("Module", module), ("Args", join_command(context.args))
569-
] if value
575+
("python.sitePackages", context.site_packages),
576+
("python.cwd", context.cwd),
577+
(
578+
"android.testInstrumentationRunnerArguments.pythonArgs",
579+
json.dumps(context.args),
580+
),
581+
]
582+
if value
570583
]
571584
if context.verbose >= 2:
572585
args.append("--info")
@@ -734,15 +747,14 @@ def ci(context):
734747
else:
735748
with TemporaryDirectory(prefix=SCRIPT_NAME) as temp_dir:
736749
print("::group::Tests")
750+
737751
# Prove the package is self-contained by using it to run the tests.
738752
shutil.unpack_archive(package_path, temp_dir)
739-
740-
# Randomization is disabled because order-dependent failures are
741-
# much less likely to pass on a rerun in single-process mode.
742-
launcher_args = ["--managed", "maxVersion", "-v"]
743-
test_args = ["--fast-ci", "--single-process", "--no-randomize"]
753+
launcher_args = [
754+
"--managed", "maxVersion", "-v", f"--{context.ci_mode}-ci"
755+
]
744756
run(
745-
["./android.py", "test", *launcher_args, "--", *test_args],
757+
["./android.py", "test", *launcher_args],
746758
cwd=temp_dir
747759
)
748760
print("::endgroup::")
@@ -825,25 +837,28 @@ def add_parser(*args, **kwargs):
825837
test.add_argument(
826838
"--cwd", metavar="DIR", type=abspath,
827839
help="Directory to copy as the app's working directory.")
828-
829-
mode_group = test.add_mutually_exclusive_group()
830-
mode_group.add_argument(
831-
"-c", dest="command", help="Execute the given Python code.")
832-
mode_group.add_argument(
833-
"-m", dest="module", help="Execute the module with the given name.")
834-
test.epilog = (
835-
"If neither -c nor -m are passed, the default is '-m test', which will "
836-
"run Python's own test suite.")
837840
test.add_argument(
838-
"args", nargs="*", help=f"Arguments to add to sys.argv. "
839-
f"Separate them from {SCRIPT_NAME}'s own arguments with `--`.")
841+
"args", nargs="*", help=f"Python command-line arguments. "
842+
f"Separate them from {SCRIPT_NAME}'s own arguments with `--`. "
843+
f"If neither -c nor -m are included, `-m test` will be prepended, "
844+
f"which will run Python's own test suite.")
840845

841846
# Package arguments.
842847
for subcommand in [package, ci]:
843848
subcommand.add_argument(
844849
"-g", action="store_true", default=False, dest="debug",
845850
help="Include debug information in package")
846851

852+
# CI arguments
853+
for subcommand in [test, ci]:
854+
group = subcommand.add_mutually_exclusive_group(required=subcommand is ci)
855+
group.add_argument(
856+
"--fast-ci", action="store_const", dest="ci_mode", const="fast",
857+
help="Add test arguments for GitHub Actions")
858+
group.add_argument(
859+
"--slow-ci", action="store_const", dest="ci_mode", const="slow",
860+
help="Add test arguments for buildbots")
861+
847862
return parser.parse_args()
848863

849864

0 commit comments

Comments
 (0)