Skip to content

Commit bea3158

Browse files
authored
Merge branch 'main' into shm_rename
2 parents fa45c2e + 561965f commit bea3158

File tree

281 files changed

+17215
-4969
lines changed

Some content is hidden

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

281 files changed

+17215
-4969
lines changed

.github/CODEOWNERS

+9-5
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,16 @@ Objects/exceptions.c @iritkatriel
107107
# Hashing & cryptographic primitives
108108
**/*hashlib* @gpshead @tiran @picnixz
109109
**/*hashopenssl* @gpshead @tiran @picnixz
110-
**/*pyhash* @gpshead @tiran
111-
**/sha* @gpshead @tiran @picnixz
112-
Modules/md5* @gpshead @tiran @picnixz
113-
**/*blake* @gpshead @tiran @picnixz
114-
Modules/_hacl/** @gpshead
110+
**/*pyhash* @gpshead @tiran @picnixz
111+
Modules/*blake* @gpshead @tiran @picnixz
112+
Modules/*md5* @gpshead @tiran @picnixz
113+
Modules/*sha* @gpshead @tiran @picnixz
114+
Modules/_hacl/** @gpshead @picnixz
115115
**/*hmac* @gpshead @picnixz
116116

117+
# libssl
118+
**/*ssl* @gpshead @picnixz
119+
117120
# logging
118121
**/*logging* @vsajip
119122

@@ -185,6 +188,7 @@ Python/ast_opt.c @isidentical @eclips4
185188
Parser/asdl.py @isidentical @JelleZijlstra @eclips4
186189
Parser/asdl_c.py @isidentical @JelleZijlstra @eclips4
187190
Lib/ast.py @isidentical @JelleZijlstra @eclips4
191+
Lib/_ast_unparse.py @isidentical @JelleZijlstra @eclips4
188192
Lib/test/test_ast/ @eclips4
189193

190194
# Mock

.github/workflows/build.yml

+11-3
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,12 @@ jobs:
164164
- false
165165
- true
166166
include:
167-
- os: windows-latest # FIXME(diegorusso): change to os: windows-aarch64
167+
# Forks don't have access to Windows on Arm runners. These jobs are skipped below:
168+
- os: ${{ github.repository_owner == 'python' && 'windows-aarch64' || 'windows-latest' }}
168169
arch: arm64
169170
free-threading: false
170-
- os: windows-latest # FIXME(diegorusso): change to os: windows-aarch64
171+
# Forks don't have access to Windows on Arm runners. These jobs are skipped below:
172+
- os: ${{ github.repository_owner == 'python' && 'windows-aarch64' || 'windows-latest' }}
171173
arch: arm64
172174
free-threading: true
173175
- os: windows-latest
@@ -187,12 +189,18 @@ jobs:
187189
strategy:
188190
fail-fast: false
189191
matrix:
192+
os:
193+
- windows-latest
190194
arch:
191195
- x86
192196
- x64
193-
- arm64
197+
include:
198+
# Forks don't have access to Windows on Arm runners. These jobs are skipped below:
199+
- os: ${{ github.repository_owner == 'python' && 'windows-aarch64' || 'windows-latest' }}
200+
arch: arm64
194201
uses: ./.github/workflows/reusable-windows-msi.yml
195202
with:
203+
os: ${{ matrix.os }}
196204
arch: ${{ matrix.arch }}
197205

198206
build-macos:

.github/workflows/jit.yml

+7-12
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ jobs:
7474
runner: windows-latest
7575
- target: aarch64-pc-windows-msvc/msvc
7676
architecture: ARM64
77-
runner: windows-latest
77+
# Forks don't have access to Windows on Arm runners. These jobs are skipped below:
78+
runner: ${{ github.repository_owner == 'python' && 'windows-aarch64' || 'windows-latest' }}
7879
- target: x86_64-apple-darwin/clang
7980
architecture: x86_64
8081
runner: macos-13
@@ -95,25 +96,19 @@ jobs:
9596
with:
9697
python-version: '3.11'
9798

98-
- name: Native Windows
99-
if: runner.os == 'Windows' && matrix.architecture != 'ARM64'
99+
- name: Windows
100+
# Forks don't have access to Windows on Arm runners. Skip those:
101+
if: runner.os == 'Windows' && (matrix.architecture != 'ARM64' || github.repository_owner == 'python')
100102
run: |
101103
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.0
102104
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }}
103105
./PCbuild/rt.bat ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3
104106
105-
# No tests (yet):
106-
- name: Emulated Windows
107-
if: runner.os == 'Windows' && matrix.architecture == 'ARM64'
108-
run: |
109-
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.0
110-
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }}
111-
112107
# The `find` line is required as a result of https://github.com/actions/runner-images/issues/9966.
113108
# This is a bug in the macOS runner image where the pre-installed Python is installed in the same
114109
# directory as the Homebrew Python, which causes the build to fail for macos-13. This line removes
115110
# the symlink to the pre-installed Python so that the Homebrew Python is used instead.
116-
- name: Native macOS
111+
- name: macOS
117112
if: runner.os == 'macOS'
118113
run: |
119114
brew update
@@ -124,7 +119,7 @@ jobs:
124119
make all --jobs 4
125120
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
126121
127-
- name: Native Linux
122+
- name: Linux
128123
if: runner.os == 'Linux'
129124
run: |
130125
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}

.github/workflows/reusable-windows-msi.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: Reusable Windows MSI
33
on:
44
workflow_call:
55
inputs:
6+
os:
7+
description: OS to run on
8+
required: true
9+
type: string
610
arch:
711
description: CPU architecture
812
required: true
@@ -17,7 +21,7 @@ env:
1721
jobs:
1822
build:
1923
name: installer for ${{ inputs.arch }}
20-
runs-on: windows-latest
24+
runs-on: ${{ inputs.os }}
2125
timeout-minutes: 60
2226
env:
2327
ARCH: ${{ inputs.arch }}
@@ -27,5 +31,7 @@ jobs:
2731
with:
2832
persist-credentials: false
2933
- name: Build CPython installer
34+
# Forks don't have access to Windows on Arm runners. Skip those:
35+
if: inputs.arch != 'arm64' || github.repository_owner == 'python'
3036
run: ./Tools/msi/build.bat --doc -"${ARCH}"
3137
shell: bash

.github/workflows/reusable-windows.yml

+9-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ env:
2424
2525
jobs:
2626
build:
27-
name: ${{ inputs.arch == 'arm64' && 'build' || 'build and test' }} (${{ inputs.arch }})
27+
name: Build and test (${{ inputs.arch }})
2828
runs-on: ${{ inputs.os }}
2929
timeout-minutes: 60
3030
env:
@@ -37,17 +37,21 @@ jobs:
3737
if: inputs.arch != 'Win32'
3838
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
3939
- name: Build CPython
40+
# Forks don't have access to Windows on Arm runners. Skip those:
41+
if: inputs.arch != 'arm64' || github.repository_owner == 'python'
4042
run: >-
4143
.\\PCbuild\\build.bat
4244
-e -d -v
4345
-p "${ARCH}"
4446
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
4547
shell: bash
46-
- name: Display build info # FIXME(diegorusso): remove the `if`
47-
if: inputs.arch != 'arm64'
48+
- name: Display build info
49+
# Forks don't have access to Windows on Arm runners. Skip those:
50+
if: inputs.arch != 'arm64' || github.repository_owner == 'python'
4851
run: .\\python.bat -m test.pythoninfo
49-
- name: Tests # FIXME(diegorusso): remove the `if`
50-
if: inputs.arch != 'arm64'
52+
- name: Tests
53+
# Forks don't have access to Windows on Arm runners. Skip those:
54+
if: inputs.arch != 'arm64' || github.repository_owner == 'python'
5155
run: >-
5256
.\\PCbuild\\rt.bat
5357
-p "${ARCH}"

.github/workflows/tail-call.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ jobs:
112112
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
113113
brew install llvm@${{ matrix.llvm }}
114114
export SDKROOT="$(xcrun --show-sdk-path)"
115-
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
116-
export PATH="/usr/local/opt/llvm/bin:$PATH"
115+
export PATH="/opt/homebrew/opt/llvm@${{ matrix.llvm }}/bin:$PATH"
116+
export PATH="/usr/local/opt/llvm@${{ matrix.llvm }}/bin:$PATH"
117117
CC=clang-19 ./configure --with-tail-call-interp
118118
make all --jobs 4
119119
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3

Android/README.md

+47-23
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
# Python for Android
22

3-
These instructions are only needed if you're planning to compile Python for
4-
Android yourself. Most users should *not* need to do this. Instead, use one of
5-
the tools listed in `Doc/using/android.rst`, which will provide a much easier
6-
experience.
3+
If you obtained this README as part of a release package, then the only
4+
applicable sections are "Prerequisites", "Testing", and "Using in your own app".
75

6+
If you obtained this README as part of the CPython source tree, then you can
7+
also follow the other sections to compile Python for Android yourself.
8+
9+
However, most app developers should not need to do any of these things manually.
10+
Instead, use one of the tools listed
11+
[here](https://docs.python.org/3/using/android.html), which will provide a much
12+
easier experience.
813

9-
## Prerequisites
1014

11-
First, make sure you have all the usual tools and libraries needed to build
12-
Python for your development machine.
15+
## Prerequisites
1316

14-
Second, you'll need an Android SDK. If you already have the SDK installed,
15-
export the `ANDROID_HOME` environment variable to point at its location.
16-
Otherwise, here's how to install it:
17+
If you already have an Android SDK installed, export the `ANDROID_HOME`
18+
environment variable to point at its location. Otherwise, here's how to install
19+
it:
1720

1821
* Download the "Command line tools" from <https://developer.android.com/studio>.
1922
* Create a directory `android-sdk/cmdline-tools`, and unzip the command line
@@ -27,15 +30,16 @@ The `android.py` script also requires the following commands to be on the `PATH`
2730
* `curl`
2831
* `java` (or set the `JAVA_HOME` environment variable)
2932
* `tar`
30-
* `unzip`
3133

3234

3335
## Building
3436

3537
Python can be built for Android on any POSIX platform supported by the Android
36-
development tools, which currently means Linux or macOS. This involves doing a
37-
cross-build where you use a "build" Python (for your development machine) to
38-
help produce a "host" Python for Android.
38+
development tools, which currently means Linux or macOS.
39+
40+
First we'll make a "build" Python (for your development machine), then use it to
41+
help produce a "host" Python for Android. So make sure you have all the usual
42+
tools and libraries needed to build Python for your development machine.
3943

4044
The easiest way to do a build is to use the `android.py` script. You can either
4145
have it perform the entire build process from start to finish in one step, or
@@ -60,8 +64,8 @@ To do all steps in a single command, run:
6064
./android.py build HOST
6165
```
6266

63-
In the end you should have a build Python in `cross-build/build`, and an Android
64-
build in `cross-build/HOST`.
67+
In the end you should have a build Python in `cross-build/build`, and a host
68+
Python in `cross-build/HOST`.
6569

6670
You can use `--` as a separator for any of the `configure`-related commands –
6771
including `build` itself – to pass arguments to the underlying `configure`
@@ -73,14 +77,27 @@ call. For example, if you want a pydebug build that also caches the results from
7377
```
7478

7579

80+
## Packaging
81+
82+
After building an architecture as described in the section above, you can
83+
package it for release with this command:
84+
85+
```sh
86+
./android.py package HOST
87+
```
88+
89+
`HOST` is defined in the section above.
90+
91+
This will generate a tarball in `cross-build/HOST/dist`, whose structure is
92+
similar to the `Android` directory of the CPython source tree.
93+
94+
7695
## Testing
7796

78-
The test suite can be run on Linux, macOS, or Windows:
97+
The Python test suite can be run on Linux, macOS, or Windows:
7998

8099
* On Linux, the emulator needs access to the KVM virtualization interface, and
81100
a DISPLAY environment variable pointing at an X server.
82-
* On Windows, you won't be able to do the build on the same machine, so you'll
83-
have to copy the `cross-build/HOST` directory from somewhere else.
84101

85102
The test suite can usually be run on a device with 2 GB of RAM, but this is
86103
borderline, so you may need to increase it to 4 GB. As of Android
@@ -90,9 +107,16 @@ and find `hw.ramSize` in both config.ini and hardware-qemu.ini. Either set these
90107
manually to the same value, or use the Android Studio Device Manager, which will
91108
update both files.
92109

93-
Before running the test suite, follow the instructions in the previous section
94-
to build the architecture you want to test. Then run the test script in one of
95-
the following modes:
110+
You can run the test suite either:
111+
112+
* Within the CPython repository, after doing a build as described above. On
113+
Windows, you won't be able to do the build on the same machine, so you'll have
114+
to copy the `cross-build/HOST/prefix` directory from somewhere else.
115+
116+
* Or by taking a release package built using the `package` command, extracting
117+
it wherever you want, and using its own copy of `android.py`.
118+
119+
The test script supports the following modes:
96120

97121
* In `--connected` mode, it runs on a device or emulator you have already
98122
connected to the build machine. List the available devices with
@@ -133,4 +157,4 @@ until you re-run `android.py make-host` or `build`.
133157

134158
## Using in your own app
135159

136-
See `Doc/using/android.rst`.
160+
See https://docs.python.org/3/using/android.html.

0 commit comments

Comments
 (0)