Skip to content

Commit 37a0e1f

Browse files
authored
Merge branch 'main' into pythongh-103501
2 parents 18c2812 + d23a2f9 commit 37a0e1f

File tree

1,428 files changed

+60215
-41094
lines changed

Some content is hidden

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

1,428 files changed

+60215
-41094
lines changed

.azure-pipelines/ci.yml

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
trigger: ['main', '3.11', '3.10', '3.9', '3.8', '3.7']
1+
trigger: ['main', '3.12', '3.11', '3.10', '3.9', '3.8', '3.7']
22

33
jobs:
44
- job: Prebuild
@@ -11,25 +11,6 @@ jobs:
1111
- template: ./prebuild-checks.yml
1212

1313

14-
- job: Ubuntu_CI_Tests
15-
displayName: Ubuntu CI Tests
16-
dependsOn: Prebuild
17-
condition: and(succeeded(), eq(dependencies.Prebuild.outputs['tests.run'], 'true'))
18-
19-
pool:
20-
vmImage: ubuntu-22.04
21-
22-
variables:
23-
testRunTitle: '$(build.sourceBranchName)-linux'
24-
testRunPlatform: linux
25-
openssl_version: 1.1.1u
26-
27-
steps:
28-
- template: ./posix-steps.yml
29-
parameters:
30-
dependencies: apt
31-
32-
3314
- job: Windows_CI_Tests
3415
displayName: Windows CI Tests
3516
dependsOn: Prebuild

.azure-pipelines/posix-steps.yml

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
parameters:
2-
sudo_dependencies: sudo
3-
dependencies: apt
4-
patchcheck: true
5-
xvfb: true
6-
71
steps:
82
- checkout: self
93
clean: true
@@ -13,7 +7,7 @@ steps:
137
- script: sudo setfacl -Rb /home/vsts
148
displayName: 'Workaround ACL issue'
159

16-
- script: ${{ parameters.sudo_dependencies }} ./.azure-pipelines/posix-deps-${{ parameters.dependencies }}.sh $(openssl_version)
10+
- script: sudo ./.azure-pipelines/posix-deps-apt.sh $(openssl_version)
1711
displayName: 'Install dependencies'
1812

1913
- script: ./configure --with-pydebug
@@ -25,27 +19,8 @@ steps:
2519
- script: make pythoninfo
2620
displayName: 'Display build info'
2721

28-
- script: $COMMAND buildbottest TESTOPTS="-j4 -uall,-cpu --junit-xml=$(build.binariesDirectory)/test-results.xml"
29-
displayName: 'Tests'
30-
env:
31-
${{ if eq(parameters.xvfb, 'true') }}:
32-
COMMAND: xvfb-run make
33-
${{ if ne(parameters.xvfb, 'true') }}:
34-
COMMAND: make
35-
36-
- ${{ if eq(parameters.patchcheck, 'true') }}:
37-
- script: |
38-
git fetch origin
39-
./python Tools/patchcheck/patchcheck.py --ci true
40-
displayName: 'Run patchcheck.py'
41-
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
42-
43-
44-
- task: PublishTestResults@2
45-
displayName: 'Publish Test Results'
46-
inputs:
47-
testResultsFiles: '$(build.binariesDirectory)/test-results.xml'
48-
mergeTestResults: true
49-
testRunTitle: $(testRunTitle)
50-
platform: $(testRunPlatform)
51-
condition: succeededOrFailed()
22+
- script: |
23+
git fetch origin
24+
./python Tools/patchcheck/patchcheck.py --ci true
25+
displayName: 'Run patchcheck.py'
26+
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))

.azure-pipelines/pr.yml

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pr: ['main', '3.11', '3.10', '3.9', '3.8', '3.7']
1+
pr: ['main', '3.12', '3.11', '3.10', '3.9', '3.8', '3.7']
22

33
jobs:
44
- job: Prebuild
@@ -11,8 +11,8 @@ jobs:
1111
- template: ./prebuild-checks.yml
1212

1313

14-
- job: Ubuntu_PR_Tests
15-
displayName: Ubuntu PR Tests
14+
- job: Ubuntu_Patchcheck
15+
displayName: Ubuntu patchcheck
1616
dependsOn: Prebuild
1717
condition: and(succeeded(), eq(dependencies.Prebuild.outputs['tests.run'], 'true'))
1818

@@ -26,36 +26,3 @@ jobs:
2626

2727
steps:
2828
- template: ./posix-steps.yml
29-
parameters:
30-
dependencies: apt
31-
32-
33-
- job: Windows_PR_Tests
34-
displayName: Windows PR Tests
35-
dependsOn: Prebuild
36-
condition: and(succeeded(), eq(dependencies.Prebuild.outputs['tests.run'], 'true'))
37-
38-
pool:
39-
vmImage: windows-2022
40-
41-
strategy:
42-
matrix:
43-
win32:
44-
arch: win32
45-
buildOpt: '-p Win32'
46-
testRunTitle: '$(System.PullRequest.TargetBranch)-win32'
47-
testRunPlatform: win32
48-
win64:
49-
arch: amd64
50-
buildOpt: '-p x64'
51-
testRunTitle: '$(System.PullRequest.TargetBranch)-win64'
52-
testRunPlatform: win64
53-
winarm64:
54-
arch: arm64
55-
buildOpt: '-p arm64'
56-
maxParallel: 4
57-
58-
steps:
59-
- template: ./windows-steps.yml
60-
parameters:
61-
targetBranch: $(System.PullRequest.TargetBranch)

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ indent_style = space
88
[*.{py,c,cpp,h}]
99
indent_size = 4
1010

11+
[*.rst]
12+
indent_size = 3
13+
1114
[*.yml]
1215
indent_size = 2

.github/workflows/build.yml

Lines changed: 94 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
run-docs: ${{ steps.docs-changes.outputs.run-docs || false }}
4141
run_tests: ${{ steps.check.outputs.run_tests }}
4242
run_hypothesis: ${{ steps.check.outputs.run_hypothesis }}
43+
run_cifuzz: ${{ steps.check.outputs.run_cifuzz }}
4344
config_hash: ${{ steps.config_hash.outputs.hash }}
4445
steps:
4546
- uses: actions/checkout@v4
@@ -76,6 +77,21 @@ jobs:
7677
echo "Run hypothesis tests"
7778
echo "run_hypothesis=true" >> $GITHUB_OUTPUT
7879
fi
80+
81+
# oss-fuzz maintains a configuration for fuzzing the main branch of
82+
# CPython, so CIFuzz should be run only for code that is likely to be
83+
# merged into the main branch; compatibility with older branches may
84+
# be broken.
85+
FUZZ_RELEVANT_FILES='(\.c$|\.h$|\.cpp$|^configure$|^\.github/workflows/build\.yml$|^Modules/_xxtestfuzz)'
86+
if [ "$GITHUB_BASE_REF" = "main" ] && [ "$(git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qE $FUZZ_RELEVANT_FILES; echo $?)" -eq 0 ]; then
87+
# The tests are pretty slow so they are executed only for PRs
88+
# changing relevant files.
89+
echo "Run CIFuzz tests"
90+
echo "run_cifuzz=true" >> $GITHUB_OUTPUT
91+
else
92+
echo "Branch too old for CIFuzz tests; or no C files were changed"
93+
echo "run_cifuzz=false" >> $GITHUB_OUTPUT
94+
fi
7995
- name: Compute hash for config cache key
8096
id: config_hash
8197
run: |
@@ -118,6 +134,8 @@ jobs:
118134
path: config.cache
119135
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
120136
- uses: actions/setup-python@v4
137+
with:
138+
python-version: '3.x'
121139
- name: Install Dependencies
122140
run: sudo ./.github/workflows/posix-deps-apt.sh
123141
- name: Add ccache to PATH
@@ -138,9 +156,6 @@ jobs:
138156
run: make regen-configure
139157
- name: Build CPython
140158
run: |
141-
# Deepfreeze will usually cause global objects to be added or removed,
142-
# so we run it before regen-global-objects gets rum (in regen-all).
143-
make regen-deepfreeze
144159
make -j4 regen-all
145160
make regen-stdlib-module-names
146161
- name: Check for changes
@@ -180,7 +195,7 @@ jobs:
180195
- name: Display build info
181196
run: .\python.bat -m test.pythoninfo
182197
- name: Tests
183-
run: .\PCbuild\rt.bat -p Win32 -d -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
198+
run: .\PCbuild\rt.bat -p Win32 -d -q --fast-ci
184199

185200
build_win_amd64:
186201
name: 'Windows (x64)'
@@ -199,7 +214,22 @@ jobs:
199214
- name: Display build info
200215
run: .\python.bat -m test.pythoninfo
201216
- name: Tests
202-
run: .\PCbuild\rt.bat -p x64 -d -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
217+
run: .\PCbuild\rt.bat -p x64 -d -q --fast-ci
218+
219+
build_win_arm64:
220+
name: 'Windows (arm64)'
221+
runs-on: windows-latest
222+
timeout-minutes: 60
223+
needs: check_source
224+
if: needs.check_source.outputs.run_tests == 'true'
225+
env:
226+
IncludeUwp: 'true'
227+
steps:
228+
- uses: actions/checkout@v4
229+
- name: Register MSVC problem matcher
230+
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
231+
- name: Build CPython
232+
run: .\PCbuild\build.bat -e -d -p arm64
203233

204234
build_macos:
205235
name: 'macOS'
@@ -235,7 +265,7 @@ jobs:
235265
- name: Display build info
236266
run: make pythoninfo
237267
- name: Tests
238-
run: make buildbottest TESTOPTS="-j4 -uall,-cpu"
268+
run: make test
239269

240270
build_ubuntu:
241271
name: 'Ubuntu'
@@ -244,7 +274,7 @@ jobs:
244274
needs: check_source
245275
if: needs.check_source.outputs.run_tests == 'true'
246276
env:
247-
OPENSSL_VER: 1.1.1v
277+
OPENSSL_VER: 3.0.11
248278
PYTHONSTRICTEXTENSIONBUILD: 1
249279
steps:
250280
- uses: actions/checkout@v4
@@ -302,7 +332,7 @@ jobs:
302332
run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
303333
- name: Tests
304334
working-directory: ${{ env.CPYTHON_BUILDDIR }}
305-
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
335+
run: xvfb-run make test
306336

307337
build_ubuntu_ssltests:
308338
name: 'Ubuntu SSL tests with OpenSSL'
@@ -313,7 +343,7 @@ jobs:
313343
strategy:
314344
fail-fast: false
315345
matrix:
316-
openssl_ver: [1.1.1v, 3.0.10, 3.1.2]
346+
openssl_ver: [1.1.1w, 3.0.11, 3.1.3]
317347
env:
318348
OPENSSL_VER: ${{ matrix.openssl_ver }}
319349
MULTISSL_DIR: ${{ github.workspace }}/multissl
@@ -365,7 +395,7 @@ jobs:
365395
needs: check_source
366396
if: needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_hypothesis == 'true'
367397
env:
368-
OPENSSL_VER: 1.1.1v
398+
OPENSSL_VER: 3.0.11
369399
PYTHONSTRICTEXTENSIONBUILD: 1
370400
steps:
371401
- uses: actions/checkout@v4
@@ -474,7 +504,7 @@ jobs:
474504
needs: check_source
475505
if: needs.check_source.outputs.run_tests == 'true'
476506
env:
477-
OPENSSL_VER: 1.1.1v
507+
OPENSSL_VER: 3.0.11
478508
PYTHONSTRICTEXTENSIONBUILD: 1
479509
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
480510
steps:
@@ -518,7 +548,47 @@ jobs:
518548
- name: Display build info
519549
run: make pythoninfo
520550
- name: Tests
521-
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
551+
run: xvfb-run make test
552+
553+
# CIFuzz job based on https://google.github.io/oss-fuzz/getting-started/continuous-integration/
554+
cifuzz:
555+
name: CIFuzz
556+
runs-on: ubuntu-latest
557+
timeout-minutes: 60
558+
needs: check_source
559+
if: needs.check_source.outputs.run_cifuzz == 'true'
560+
permissions:
561+
security-events: write
562+
strategy:
563+
fail-fast: false
564+
matrix:
565+
sanitizer: [address, undefined, memory]
566+
steps:
567+
- name: Build fuzzers (${{ matrix.sanitizer }})
568+
id: build
569+
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
570+
with:
571+
oss-fuzz-project-name: cpython3
572+
sanitizer: ${{ matrix.sanitizer }}
573+
- name: Run fuzzers (${{ matrix.sanitizer }})
574+
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
575+
with:
576+
fuzz-seconds: 600
577+
oss-fuzz-project-name: cpython3
578+
output-sarif: true
579+
sanitizer: ${{ matrix.sanitizer }}
580+
- name: Upload crash
581+
uses: actions/upload-artifact@v3
582+
if: failure() && steps.build.outcome == 'success'
583+
with:
584+
name: ${{ matrix.sanitizer }}-artifacts
585+
path: ./out/artifacts
586+
- name: Upload SARIF
587+
if: always() && steps.build.outcome == 'success'
588+
uses: github/codeql-action/upload-sarif@v2
589+
with:
590+
sarif_file: cifuzz-sarif/results.sarif
591+
checkout_path: cifuzz-sarif
522592

523593
all-required-green: # This job does nothing and is only used for the branch protection
524594
name: All required checks pass
@@ -530,11 +600,13 @@ jobs:
530600
- check_generated_files
531601
- build_win32
532602
- build_win_amd64
603+
- build_win_arm64
533604
- build_macos
534605
- build_ubuntu
535606
- build_ubuntu_ssltests
536607
- test_hypothesis
537608
- build_asan
609+
- cifuzz
538610

539611
runs-on: ubuntu-latest
540612

@@ -546,6 +618,8 @@ jobs:
546618
build_macos,
547619
build_ubuntu_ssltests,
548620
build_win32,
621+
build_win_arm64,
622+
cifuzz,
549623
test_hypothesis,
550624
allowed-skips: >-
551625
${{
@@ -561,13 +635,21 @@ jobs:
561635
check_generated_files,
562636
build_win32,
563637
build_win_amd64,
638+
build_win_arm64,
564639
build_macos,
565640
build_ubuntu,
566641
build_ubuntu_ssltests,
567642
build_asan,
568643
'
569644
|| ''
570645
}}
646+
${{
647+
!fromJSON(needs.check_source.outputs.run_cifuzz)
648+
&& '
649+
cifuzz,
650+
'
651+
|| ''
652+
}}
571653
${{
572654
!fromJSON(needs.check_source.outputs.run_hypothesis)
573655
&& '

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ permissions:
77

88
env:
99
FORCE_COLOR: 1
10-
RUFF_FORMAT: github
10+
RUFF_OUTPUT_FORMAT: github
1111

1212
concurrency:
1313
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}

0 commit comments

Comments
 (0)