Skip to content

Commit 3a53bc2

Browse files
Merge branch 'main' into fix-pdb
2 parents 4c026ad + 63cc125 commit 3a53bc2

File tree

125 files changed

+16586
-1502
lines changed

Some content is hidden

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

125 files changed

+16586
-1502
lines changed

.github/workflows/build.yml

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -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 }}

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

Doc/c-api/exceptions.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,17 @@ Exception Classes
793793
Return :c:member:`~PyTypeObject.tp_name` of the exception class *ob*.
794794
795795
796+
.. c:macro:: PyException_HEAD
797+
798+
This is a :term:`soft deprecated` macro including the base fields for an
799+
exception object.
800+
801+
This was included in Python's C API by mistake and is not designed for use
802+
in extensions. For creating custom exception objects, use
803+
:c:func:`PyErr_NewException` or otherwise create a class inheriting from
804+
:c:data:`PyExc_BaseException`.
805+
806+
796807
Exception Objects
797808
=================
798809

Doc/c-api/long.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,8 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
453453
454454
Otherwise, returns the number of bytes required to store the value.
455455
If this is equal to or less than *n_bytes*, the entire value was copied.
456-
All *n_bytes* of the buffer are written: large buffers are padded with
457-
zeroes.
456+
All *n_bytes* of the buffer are written: remaining bytes filled by
457+
copies of the sign bit.
458458
459459
If the returned value is greater than *n_bytes*, the value was
460460
truncated: as many of the lowest bits of the value as could fit are written,

Doc/c-api/memory.rst

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -293,17 +293,39 @@ The following type-oriented macros are provided for convenience. Note that
293293
294294
Same as :c:func:`PyMem_Free`.
295295
296-
In addition, the following macro sets are provided for calling the Python memory
297-
allocator directly, without involving the C API functions listed above. However,
298-
note that their use does not preserve binary compatibility across Python
299-
versions and is therefore deprecated in extension modules.
300-
301-
* ``PyMem_MALLOC(size)``
302-
* ``PyMem_NEW(type, size)``
303-
* ``PyMem_REALLOC(ptr, size)``
304-
* ``PyMem_RESIZE(ptr, type, size)``
305-
* ``PyMem_FREE(ptr)``
306-
* ``PyMem_DEL(ptr)``
296+
297+
Deprecated aliases
298+
------------------
299+
300+
These are :term:`soft deprecated` aliases to existing functions and macros.
301+
They exist solely for backwards compatibility.
302+
303+
.. list-table::
304+
:widths: auto
305+
:header-rows: 1
306+
307+
* * Deprecated alias
308+
* Corresponding function or macro
309+
* * .. c:macro:: PyMem_MALLOC(size)
310+
* :c:func:`PyMem_Malloc`
311+
* * .. c:macro:: PyMem_NEW(type, size)
312+
* :c:macro:`PyMem_New`
313+
* * .. c:macro:: PyMem_REALLOC(ptr, size)
314+
* :c:func:`PyMem_Realloc`
315+
* * .. c:macro:: PyMem_RESIZE(ptr, type, size)
316+
* :c:macro:`PyMem_Resize`
317+
* * .. c:macro:: PyMem_FREE(ptr)
318+
* :c:func:`PyMem_Free`
319+
* * .. c:macro:: PyMem_DEL(ptr)
320+
* :c:func:`PyMem_Free`
321+
322+
.. versionchanged:: 3.4
323+
324+
The macros are now aliases of the corresponding functions and macros.
325+
Previously, their behavior was the same, but their use did not necessarily
326+
preserve binary compatibility across Python versions.
327+
328+
.. deprecated:: 2.0
307329
308330
309331
.. _objectinterface:

Doc/c-api/object.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Object Protocol
8585
instead of the :func:`repr`.
8686
8787
88-
.. c:function:: void PyUnstable_Object_Dump(PyObject *op)
88+
.. c:function:: void PyObject_Dump(PyObject *op)
8989
9090
Dump an object *op* to ``stderr``. This should only be used for debugging.
9191

Doc/library/profiling.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. highlight:: shell-session
1+
.. highlight:: sh
22

33
.. _profiling-module:
44

0 commit comments

Comments
 (0)