Skip to content

Commit fff7bb4

Browse files
Merge branch 'main' into fix_kyiv
2 parents 496d9c3 + 6640f1d commit fff7bb4

File tree

1,444 files changed

+39948
-23382
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,444 files changed

+39948
-23382
lines changed

.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/ISSUE_TEMPLATE/bug.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ body:
3939
- "3.10"
4040
- "3.11"
4141
- "3.12"
42+
- "3.13"
4243
- "CPython main branch"
4344
validations:
4445
required: true

.github/workflows/build.yml

Lines changed: 74 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: |
@@ -140,9 +156,6 @@ jobs:
140156
run: make regen-configure
141157
- name: Build CPython
142158
run: |
143-
# Deepfreeze will usually cause global objects to be added or removed,
144-
# so we run it before regen-global-objects gets rum (in regen-all).
145-
make regen-deepfreeze
146159
make -j4 regen-all
147160
make regen-stdlib-module-names
148161
- name: Check for changes
@@ -182,7 +195,7 @@ jobs:
182195
- name: Display build info
183196
run: .\python.bat -m test.pythoninfo
184197
- name: Tests
185-
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
186199

187200
build_win_amd64:
188201
name: 'Windows (x64)'
@@ -201,7 +214,7 @@ jobs:
201214
- name: Display build info
202215
run: .\python.bat -m test.pythoninfo
203216
- name: Tests
204-
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
205218

206219
build_win_arm64:
207220
name: 'Windows (arm64)'
@@ -252,7 +265,7 @@ jobs:
252265
- name: Display build info
253266
run: make pythoninfo
254267
- name: Tests
255-
run: make buildbottest TESTOPTS="-j4 -uall,-cpu"
268+
run: make test
256269

257270
build_ubuntu:
258271
name: 'Ubuntu'
@@ -261,7 +274,7 @@ jobs:
261274
needs: check_source
262275
if: needs.check_source.outputs.run_tests == 'true'
263276
env:
264-
OPENSSL_VER: 1.1.1v
277+
OPENSSL_VER: 3.0.11
265278
PYTHONSTRICTEXTENSIONBUILD: 1
266279
steps:
267280
- uses: actions/checkout@v4
@@ -319,7 +332,7 @@ jobs:
319332
run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
320333
- name: Tests
321334
working-directory: ${{ env.CPYTHON_BUILDDIR }}
322-
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
335+
run: xvfb-run make test
323336

324337
build_ubuntu_ssltests:
325338
name: 'Ubuntu SSL tests with OpenSSL'
@@ -330,7 +343,7 @@ jobs:
330343
strategy:
331344
fail-fast: false
332345
matrix:
333-
openssl_ver: [1.1.1v, 3.0.10, 3.1.2]
346+
openssl_ver: [1.1.1w, 3.0.11, 3.1.3]
334347
env:
335348
OPENSSL_VER: ${{ matrix.openssl_ver }}
336349
MULTISSL_DIR: ${{ github.workspace }}/multissl
@@ -382,7 +395,7 @@ jobs:
382395
needs: check_source
383396
if: needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_hypothesis == 'true'
384397
env:
385-
OPENSSL_VER: 1.1.1v
398+
OPENSSL_VER: 3.0.11
386399
PYTHONSTRICTEXTENSIONBUILD: 1
387400
steps:
388401
- uses: actions/checkout@v4
@@ -491,7 +504,7 @@ jobs:
491504
needs: check_source
492505
if: needs.check_source.outputs.run_tests == 'true'
493506
env:
494-
OPENSSL_VER: 1.1.1v
507+
OPENSSL_VER: 3.0.11
495508
PYTHONSTRICTEXTENSIONBUILD: 1
496509
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
497510
steps:
@@ -535,7 +548,47 @@ jobs:
535548
- name: Display build info
536549
run: make pythoninfo
537550
- name: Tests
538-
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
539592

540593
all-required-green: # This job does nothing and is only used for the branch protection
541594
name: All required checks pass
@@ -553,6 +606,7 @@ jobs:
553606
- build_ubuntu_ssltests
554607
- test_hypothesis
555608
- build_asan
609+
- cifuzz
556610

557611
runs-on: ubuntu-latest
558612

@@ -565,6 +619,7 @@ jobs:
565619
build_ubuntu_ssltests,
566620
build_win32,
567621
build_win_arm64,
622+
cifuzz,
568623
test_hypothesis,
569624
allowed-skips: >-
570625
${{
@@ -588,6 +643,13 @@ jobs:
588643
'
589644
|| ''
590645
}}
646+
${{
647+
!fromJSON(needs.check_source.outputs.run_cifuzz)
648+
&& '
649+
cifuzz,
650+
'
651+
|| ''
652+
}}
591653
${{
592654
!fromJSON(needs.check_source.outputs.run_hypothesis)
593655
&& '

.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 }}

.github/workflows/reusable-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
- name: 'Set up Python'
7575
uses: actions/setup-python@v4
7676
with:
77-
python-version: '3.11' # known to work with Sphinx 3.2
77+
python-version: '3.11' # known to work with Sphinx 4.2
7878
cache: 'pip'
7979
cache-dependency-path: 'Doc/requirements-oldest-sphinx.txt'
8080
- name: 'Install build dependencies'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ gmon.out
4242
.coverage
4343
.mypy_cache/
4444
.pytest_cache/
45+
.ruff_cache/
4546
.DS_Store
4647

4748
*.exe

.pre-commit-config.yaml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.0.288
3+
rev: v0.1.0
44
hooks:
55
- id: ruff
66
name: Run Ruff on Lib/test/
77
args: [--exit-non-zero-on-fix]
88
files: ^Lib/test/
9+
- id: ruff
10+
name: Run Ruff on Argument Clinic
11+
args: [--exit-non-zero-on-fix, --config=Tools/clinic/.ruff.toml]
12+
files: ^Tools/clinic/|Lib/test/test_clinic.py
913

1014
- repo: https://github.com/pre-commit/pre-commit-hooks
11-
rev: v4.4.0
15+
rev: v4.5.0
1216
hooks:
1317
- id: check-toml
1418
exclude: ^Lib/test/test_tomllib/
@@ -17,12 +21,16 @@ repos:
1721
types: [python]
1822
exclude: Lib/test/tokenizedata/coding20731.py
1923
- id: trailing-whitespace
20-
types_or: [c, python, rst]
24+
types_or: [c, inc, python, rst]
2125

2226
- repo: https://github.com/sphinx-contrib/sphinx-lint
23-
rev: v0.6.8
27+
rev: v0.8.1
2428
hooks:
2529
- id: sphinx-lint
2630
args: [--enable=default-role]
2731
files: ^Doc/|^Misc/NEWS.d/next/
28-
types: [rst]
32+
33+
- repo: meta
34+
hooks:
35+
- id: check-hooks-apply
36+
- id: check-useless-excludes

Doc/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
PYTHON = python3
88
VENVDIR = ./venv
99
SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build
10-
SPHINXLINT = PATH=$(VENVDIR)/bin:$$PATH sphinx-lint
1110
BLURB = PATH=$(VENVDIR)/bin:$$PATH blurb
1211
JOBS = auto
1312
PAPER =

Doc/c-api/arg.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,10 @@ API Functions
416416
.. c:function:: int PyArg_ParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], ...)
417417
418418
Parse the parameters of a function that takes both positional and keyword
419-
parameters into local variables. The *keywords* argument is a
420-
``NULL``-terminated array of keyword parameter names. Empty names denote
419+
parameters into local variables.
420+
The *keywords* argument is a ``NULL``-terminated array of keyword parameter
421+
names specified as null-terminated ASCII or UTF-8 encoded C strings.
422+
Empty names denote
421423
:ref:`positional-only parameters <positional-only_parameter>`.
422424
Returns true on success; on failure, it returns false and raises the
423425
appropriate exception.
@@ -426,6 +428,9 @@ API Functions
426428
Added support for :ref:`positional-only parameters
427429
<positional-only_parameter>`.
428430
431+
.. versionchanged:: 3.13
432+
Added support for non-ASCII keyword parameter names.
433+
429434
430435
.. c:function:: int PyArg_VaParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], va_list vargs)
431436

Doc/c-api/call.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ This is a pointer to a function with the following signature:
108108
Doing so will allow callables such as bound methods to make their onward
109109
calls (which include a prepended *self* argument) very efficiently.
110110

111+
.. versionadded:: 3.8
112+
111113
To call an object that implements vectorcall, use a :ref:`call API <capi-call>`
112114
function as with any other callable.
113115
:c:func:`PyObject_Vectorcall` will usually be most efficient.

Doc/c-api/init.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,19 @@ code, or when embedding the Python interpreter:
870870
When the current thread state is ``NULL``, this issues a fatal error (so that
871871
the caller needn't check for ``NULL``).
872872
873+
See also :c:func:`PyThreadState_GetUnchecked`.
874+
875+
876+
.. c:function:: PyThreadState* PyThreadState_GetUnchecked()
877+
878+
Similar to :c:func:`PyThreadState_Get`, but don't kill the process with a
879+
fatal error if it is NULL. The caller is responsible to check if the result
880+
is NULL.
881+
882+
.. versionadded:: 3.13
883+
In Python 3.5 to 3.12, the function was private and known as
884+
``_PyThreadState_UncheckedGet()``.
885+
873886
874887
.. c:function:: PyThreadState* PyThreadState_Swap(PyThreadState *tstate)
875888

0 commit comments

Comments
 (0)