Skip to content

Commit eda3442

Browse files
authored
Merge branch 'main' into deprecate-inherited-runtime-protocols
2 parents 5bccce1 + 03e651d commit eda3442

File tree

428 files changed

+29294
-7916
lines changed

Some content is hidden

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

428 files changed

+29294
-7916
lines changed

.github/CODEOWNERS

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
.azure-pipelines/ @AA-Turner
6464

6565
# GitHub & related scripts
66-
.github/ @ezio-melotti @hugovk @AA-Turner
67-
Tools/build/compute-changes.py @AA-Turner
66+
.github/ @ezio-melotti @hugovk @AA-Turner @webknjaz
67+
Tools/build/compute-changes.py @AA-Turner @hugovk @webknjaz
6868
Tools/build/verify_ensurepip_wheels.py @AA-Turner @pfmoore @pradyunsg
6969

7070
# Pre-commit
@@ -176,9 +176,10 @@ Tools/wasm/config.site-wasm32-emscripten @freakboy3742 @emmatyping
176176
Tools/wasm/emscripten @freakboy3742 @emmatyping
177177

178178
# WebAssembly (WASI)
179-
Tools/wasm/wasi-env @brettcannon @emmatyping
180-
Tools/wasm/wasi.py @brettcannon @emmatyping
181-
Tools/wasm/wasi @brettcannon @emmatyping
179+
Platforms/WASI @brettcannon @emmatyping @savannahostrowski
180+
Tools/wasm/wasi-env @brettcannon @emmatyping @savannahostrowski
181+
Tools/wasm/wasi.py @brettcannon @emmatyping @savannahostrowski
182+
Tools/wasm/wasi @brettcannon @emmatyping @savannahostrowski
182183

183184
# Windows
184185
PC/ @python/windows-team

.github/workflows/build.yml

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ jobs:
261261
# Keep 1.1.1w in our list despite it being upstream EOL and otherwise
262262
# unsupported as it most resembles other 1.1.1-work-a-like ssl APIs
263263
# supported by important vendors such as AWS-LC.
264-
openssl_ver: [1.1.1w, 3.0.18, 3.2.6, 3.3.5, 3.4.3, 3.5.4]
264+
openssl_ver: [1.1.1w, 3.0.18, 3.3.5, 3.4.3, 3.5.4, 3.6.0]
265265
# See Tools/ssl/make_ssl_data.py for notes on adding a new version
266266
env:
267267
OPENSSL_VER: ${{ matrix.openssl_ver }}
@@ -641,45 +641,45 @@ jobs:
641641
run: |
642642
"$BUILD_DIR/cross-python/bin/python3" -m test test_sysconfig test_site test_embed
643643
644-
# CIFuzz job based on https://google.github.io/oss-fuzz/getting-started/continuous-integration/
645644
cifuzz:
646-
name: CIFuzz
647-
runs-on: ubuntu-latest
648-
timeout-minutes: 60
645+
# ${{ '' } is a hack to nest jobs under the same sidebar category.
646+
name: CIFuzz${{ '' }} # zizmor: ignore[obfuscation]
649647
needs: build-context
650-
if: needs.build-context.outputs.run-ci-fuzz == 'true'
648+
if: >-
649+
needs.build-context.outputs.run-ci-fuzz == 'true'
650+
|| needs.build-context.outputs.run-ci-fuzz-stdlib == 'true'
651651
permissions:
652652
security-events: write
653653
strategy:
654654
fail-fast: false
655655
matrix:
656-
sanitizer: [address, undefined, memory]
657-
steps:
658-
- name: Build fuzzers (${{ matrix.sanitizer }})
659-
id: build
660-
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
661-
with:
662-
oss-fuzz-project-name: cpython3
663-
sanitizer: ${{ matrix.sanitizer }}
664-
- name: Run fuzzers (${{ matrix.sanitizer }})
665-
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
666-
with:
667-
fuzz-seconds: 600
668-
oss-fuzz-project-name: cpython3
669-
output-sarif: true
670-
sanitizer: ${{ matrix.sanitizer }}
671-
- name: Upload crash
672-
if: failure() && steps.build.outcome == 'success'
673-
uses: actions/upload-artifact@v6
674-
with:
675-
name: ${{ matrix.sanitizer }}-artifacts
676-
path: ./out/artifacts
677-
- name: Upload SARIF
678-
if: always() && steps.build.outcome == 'success'
679-
uses: github/codeql-action/upload-sarif@v4
680-
with:
681-
sarif_file: cifuzz-sarif/results.sarif
682-
checkout_path: cifuzz-sarif
656+
sanitizer:
657+
- address
658+
- undefined
659+
- memory
660+
oss-fuzz-project-name:
661+
- cpython3
662+
- python3-libraries
663+
exclude:
664+
# Note that the 'no-exclude' sentinel below is to prevent
665+
# an empty string value from excluding all jobs and causing
666+
# GHA to create a 'default' matrix entry with all empty values.
667+
- oss-fuzz-project-name: >-
668+
${{
669+
needs.build-context.outputs.run-ci-fuzz == 'true'
670+
&& 'no-exclude'
671+
|| 'cpython3'
672+
}}
673+
- oss-fuzz-project-name: >-
674+
${{
675+
needs.build-context.outputs.run-ci-fuzz-stdlib == 'true'
676+
&& 'no-exclude'
677+
|| 'python3-libraries'
678+
}}
679+
uses: ./.github/workflows/reusable-cifuzz.yml
680+
with:
681+
oss-fuzz-project-name: ${{ matrix.oss-fuzz-project-name }}
682+
sanitizer: ${{ matrix.sanitizer }}
683683

684684
all-required-green: # This job does nothing and is only used for the branch protection
685685
name: All required checks pass
@@ -734,7 +734,12 @@ jobs:
734734
|| ''
735735
}}
736736
${{ !fromJSON(needs.build-context.outputs.run-windows-tests) && 'build-windows,' || '' }}
737-
${{ !fromJSON(needs.build-context.outputs.run-ci-fuzz) && 'cifuzz,' || '' }}
737+
${{
738+
!fromJSON(needs.build-context.outputs.run-ci-fuzz)
739+
&& !fromJSON(needs.build-context.outputs.run-ci-fuzz-stdlib)
740+
&& 'cifuzz,' ||
741+
''
742+
}}
738743
${{ !fromJSON(needs.build-context.outputs.run-macos) && 'build-macos,' || '' }}
739744
${{
740745
!fromJSON(needs.build-context.outputs.run-ubuntu)

.github/workflows/jit.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- 'Python/optimizer*.c'
88
- 'Python/executor_cases.c.h'
99
- 'Python/optimizer_cases.c.h'
10+
- '**_testinternalcapi**'
1011
- '!Python/perf_jit_trampoline.c'
1112
- '!**/*.md'
1213
- '!**/*.ini'
@@ -17,6 +18,7 @@ on:
1718
- 'Python/optimizer*.c'
1819
- 'Python/executor_cases.c.h'
1920
- 'Python/optimizer_cases.c.h'
21+
- '**_testinternalcapi**'
2022
- '!Python/perf_jit_trampoline.c'
2123
- '!**/*.md'
2224
- '!**/*.ini'
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# CIFuzz job based on https://google.github.io/oss-fuzz/getting-started/continuous-integration/
2+
name: Reusable CIFuzz
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
oss-fuzz-project-name:
8+
description: OSS-Fuzz project name
9+
required: true
10+
type: string
11+
sanitizer:
12+
description: OSS-Fuzz sanitizer
13+
required: true
14+
type: string
15+
16+
jobs:
17+
cifuzz:
18+
name: ${{ inputs.oss-fuzz-project-name }} (${{ inputs.sanitizer }})
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 60
21+
steps:
22+
- name: Build fuzzers (${{ inputs.sanitizer }})
23+
id: build
24+
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
25+
with:
26+
oss-fuzz-project-name: ${{ inputs.oss-fuzz-project-name }}
27+
sanitizer: ${{ inputs.sanitizer }}
28+
- name: Run fuzzers (${{ inputs.sanitizer }})
29+
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
30+
with:
31+
fuzz-seconds: 600
32+
oss-fuzz-project-name: ${{ inputs.oss-fuzz-project-name }}
33+
output-sarif: true
34+
sanitizer: ${{ inputs.sanitizer }}
35+
- name: Upload crash
36+
if: failure() && steps.build.outcome == 'success'
37+
uses: actions/upload-artifact@v6
38+
with:
39+
name: ${{ inputs.sanitizer }}-artifacts
40+
path: ./out/artifacts
41+
- name: Upload SARIF
42+
if: always() && steps.build.outcome == 'success'
43+
uses: github/codeql-action/upload-sarif@v4
44+
with:
45+
sarif_file: cifuzz-sarif/results.sarif
46+
checkout_path: cifuzz-sarif

.github/workflows/reusable-context.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ on: # yamllint disable-line rule:truthy
2121
description: Whether to run the Android tests
2222
value: ${{ jobs.compute-changes.outputs.run-android }} # bool
2323
run-ci-fuzz:
24-
description: Whether to run the CIFuzz job
24+
description: Whether to run the CIFuzz job for 'cpython' fuzzer
2525
value: ${{ jobs.compute-changes.outputs.run-ci-fuzz }} # bool
26+
run-ci-fuzz-stdlib:
27+
description: Whether to run the CIFuzz job for 'python3-libraries' fuzzer
28+
value: ${{ jobs.compute-changes.outputs.run-ci-fuzz-stdlib }} # bool
2629
run-docs:
2730
description: Whether to build the docs
2831
value: ${{ jobs.compute-changes.outputs.run-docs }} # bool
@@ -56,6 +59,7 @@ jobs:
5659
outputs:
5760
run-android: ${{ steps.changes.outputs.run-android }}
5861
run-ci-fuzz: ${{ steps.changes.outputs.run-ci-fuzz }}
62+
run-ci-fuzz-stdlib: ${{ steps.changes.outputs.run-ci-fuzz-stdlib }}
5963
run-docs: ${{ steps.changes.outputs.run-docs }}
6064
run-ios: ${{ steps.changes.outputs.run-ios }}
6165
run-macos: ${{ steps.changes.outputs.run-macos }}

.github/workflows/reusable-wasi.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ jobs:
4747
- name: "Runner image version"
4848
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
4949
- name: "Configure build Python"
50-
run: python3 Tools/wasm/wasi configure-build-python -- --config-cache --with-pydebug
50+
run: python3 Platforms/WASI configure-build-python -- --config-cache --with-pydebug
5151
- name: "Make build Python"
52-
run: python3 Tools/wasm/wasi make-build-python
52+
run: python3 Platforms/WASI make-build-python
5353
- name: "Configure host"
5454
# `--with-pydebug` inferred from configure-build-python
55-
run: python3 Tools/wasm/wasi configure-host -- --config-cache
55+
run: python3 Platforms/WASI configure-host -- --config-cache
5656
- name: "Make host"
57-
run: python3 Tools/wasm/wasi make-host
57+
run: python3 Platforms/WASI make-host
5858
- name: "Display build info"
5959
run: make --directory "${CROSS_BUILD_WASI}" pythoninfo
6060
- name: "Test"

Doc/c-api/call.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ please see individual documentation for details.
347347
348348
.. versionadded:: 3.9
349349
350+
.. c:function:: PyObject* _PyObject_Vectorcall(PyObject *callable, PyObject *const *args, size_t nargsf, PyObject *kwnames)
351+
:no-typesetting:
350352
351353
.. c:function:: PyObject* PyObject_Vectorcall(PyObject *callable, PyObject *const *args, size_t nargsf, PyObject *kwnames)
352354
@@ -358,7 +360,12 @@ please see individual documentation for details.
358360
Return the result of the call on success, or raise an exception and return
359361
*NULL* on failure.
360362
361-
.. versionadded:: 3.9
363+
.. versionadded:: 3.8 as ``_PyObject_Vectorcall``
364+
365+
.. versionchanged:: 3.9
366+
367+
Renamed to the current name, without the leading underscore.
368+
The old provisional name is :term:`soft deprecated`.
362369
363370
.. c:function:: PyObject* PyObject_VectorcallDict(PyObject *callable, PyObject *const *args, size_t nargsf, PyObject *kwdict)
364371

Doc/c-api/code.rst

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,14 @@ bound into a function.
6969
The old name is deprecated, but will remain available until the
7070
signature changes again.
7171
72+
.. c:function:: PyCodeObject* PyCode_NewWithPosOnlyArgs(...)
73+
:no-typesetting:
74+
7275
.. c:function:: PyCodeObject* PyUnstable_Code_NewWithPosOnlyArgs(int argcount, int posonlyargcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, PyObject *qualname, int firstlineno, PyObject *linetable, PyObject *exceptiontable)
7376
7477
Similar to :c:func:`PyUnstable_Code_New`, but with an extra "posonlyargcount" for positional-only arguments.
7578
The same caveats that apply to ``PyUnstable_Code_New`` also apply to this function.
7679
77-
.. index:: single: PyCode_NewWithPosOnlyArgs (C function)
78-
7980
.. versionadded:: 3.8 as ``PyCode_NewWithPosOnlyArgs``
8081
8182
.. versionchanged:: 3.11
@@ -298,6 +299,9 @@ These functions are part of the unstable C API tier:
298299
this functionality is a CPython implementation detail, and the API
299300
may change without deprecation warnings.
300301
302+
.. c:function:: Py_ssize_t _PyEval_RequestCodeExtraIndex(freefunc free)
303+
:no-typesetting:
304+
301305
.. c:function:: Py_ssize_t PyUnstable_Eval_RequestCodeExtraIndex(freefunc free)
302306
303307
Return a new opaque index value used to adding data to code objects.
@@ -310,8 +314,6 @@ may change without deprecation warnings.
310314
*free* will be called on non-``NULL`` data stored under the new index.
311315
Use :c:func:`Py_DecRef` when storing :c:type:`PyObject`.
312316
313-
.. index:: single: _PyEval_RequestCodeExtraIndex (C function)
314-
315317
.. versionadded:: 3.6 as ``_PyEval_RequestCodeExtraIndex``
316318
317319
.. versionchanged:: 3.12
@@ -320,6 +322,9 @@ may change without deprecation warnings.
320322
The old private name is deprecated, but will be available until the API
321323
changes.
322324
325+
.. c:function:: int _PyCode_GetExtra(PyObject *code, Py_ssize_t index, void **extra)
326+
:no-typesetting:
327+
323328
.. c:function:: int PyUnstable_Code_GetExtra(PyObject *code, Py_ssize_t index, void **extra)
324329
325330
Set *extra* to the extra data stored under the given index.
@@ -328,8 +333,6 @@ may change without deprecation warnings.
328333
If no data was set under the index, set *extra* to ``NULL`` and return
329334
0 without setting an exception.
330335
331-
.. index:: single: _PyCode_GetExtra (C function)
332-
333336
.. versionadded:: 3.6 as ``_PyCode_GetExtra``
334337
335338
.. versionchanged:: 3.12
@@ -338,13 +341,14 @@ may change without deprecation warnings.
338341
The old private name is deprecated, but will be available until the API
339342
changes.
340343
344+
.. c:function:: int _PyCode_SetExtra(PyObject *code, Py_ssize_t index, void *extra)
345+
:no-typesetting:
346+
341347
.. c:function:: int PyUnstable_Code_SetExtra(PyObject *code, Py_ssize_t index, void *extra)
342348
343349
Set the extra data stored under the given index to *extra*.
344350
Return 0 on success. Set an exception and return -1 on failure.
345351
346-
.. index:: single: _PyCode_SetExtra (C function)
347-
348352
.. versionadded:: 3.6 as ``_PyCode_SetExtra``
349353
350354
.. versionchanged:: 3.12

Doc/c-api/conversion.rst

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ The following functions provide locale-independent string to number conversions.
130130
131131
*flags* can be zero or more of the following values or-ed together:
132132
133+
.. c:namespace:: NULL
134+
133135
.. c:macro:: Py_DTSF_SIGN
134136
135137
Always precede the returned string with a sign
@@ -151,9 +153,21 @@ The following functions provide locale-independent string to number conversions.
151153
152154
.. versionadded:: 3.11
153155
154-
If *ptype* is non-``NULL``, then the value it points to will be set to one of
155-
``Py_DTST_FINITE``, ``Py_DTST_INFINITE``, or ``Py_DTST_NAN``, signifying that
156-
*val* is a finite number, an infinite number, or not a number, respectively.
156+
If *ptype* is non-``NULL``, then the value it points to will be set to one
157+
of the following constants depending on the type of *val*:
158+
159+
.. list-table::
160+
:header-rows: 1
161+
:align: left
162+
163+
* - *\*ptype*
164+
- type of *val*
165+
* - .. c:macro:: Py_DTST_FINITE
166+
- finite number
167+
* - .. c:macro:: Py_DTST_INFINITE
168+
- infinite number
169+
* - .. c:macro:: Py_DTST_NAN
170+
- not a number
157171
158172
The return value is a pointer to *buffer* with the converted string or
159173
``NULL`` if the conversion failed. The caller is responsible for freeing the

Doc/c-api/descriptor.rst

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ found in the dictionary of type objects.
1010

1111
.. XXX document these!
1212
13-
.. c:var:: PyTypeObject PyProperty_Type
14-
15-
The type object for the built-in descriptor types.
16-
17-
1813
.. c:function:: PyObject* PyDescr_NewGetSet(PyTypeObject *type, struct PyGetSetDef *getset)
1914
2015
@@ -74,9 +69,26 @@ found in the dictionary of type objects.
7469
.. c:function:: PyObject* PyWrapper_New(PyObject *, PyObject *)
7570
7671
72+
.. c:macro:: PyDescr_COMMON
73+
74+
This is a :term:`soft deprecated` macro including the common fields for a
75+
descriptor object.
76+
77+
This was included in Python's C API by mistake; do not use it in extensions.
78+
For creating custom descriptor objects, create a class implementing the
79+
descriptor protocol (:c:member:`~PyTypeObject.tp_descr_get` and
80+
:c:member:`~PyTypeObject.tp_descr_set`).
81+
82+
7783
Built-in descriptors
7884
^^^^^^^^^^^^^^^^^^^^
7985
86+
.. c:var:: PyTypeObject PyProperty_Type
87+
88+
The type object for property objects. This is the same object as
89+
:class:`property` in the Python layer.
90+
91+
8092
.. c:var:: PyTypeObject PySuper_Type
8193
8294
The type object for super objects. This is the same object as

0 commit comments

Comments
 (0)