Skip to content

Commit abfe97e

Browse files
Merge branch 'main' into gh-143005-ctypes-class-safety
2 parents 32fac41 + 7d151e5 commit abfe97e

File tree

70 files changed

+15535
-945
lines changed

Some content is hidden

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

70 files changed

+15535
-945
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)
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/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

Doc/library/profiling.sampling.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-sampling:
44

Doc/whatsnew/3.15.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ New features
12611261
* Add :c:func:`PyTuple_FromArray` to create a :class:`tuple` from an array.
12621262
(Contributed by Victor Stinner in :gh:`111489`.)
12631263

1264-
* Add :c:func:`PyUnstable_Object_Dump` to dump an object to ``stderr``.
1264+
* Add :c:func:`PyObject_Dump` to dump an object to ``stderr``.
12651265
It should only be used for debugging.
12661266
(Contributed by Victor Stinner in :gh:`141070`.)
12671267

Include/cpython/object.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,10 @@ PyAPI_FUNC(PyObject *) PyType_GetDict(PyTypeObject *);
295295

296296
PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int);
297297
PyAPI_FUNC(void) _Py_BreakPoint(void);
298-
PyAPI_FUNC(void) PyUnstable_Object_Dump(PyObject *);
298+
PyAPI_FUNC(void) PyObject_Dump(PyObject *);
299299

300300
// Alias for backward compatibility
301-
#define _PyObject_Dump PyUnstable_Object_Dump
301+
#define _PyObject_Dump PyObject_Dump
302302

303303
Py_DEPRECATED(3.15) PyAPI_FUNC(PyObject*) _PyObject_GetAttrId(PyObject *, _Py_Identifier *);
304304

@@ -391,7 +391,7 @@ PyAPI_FUNC(PyObject *) _PyObject_FunctionStr(PyObject *);
391391
but compile away to nothing if NDEBUG is defined.
392392
393393
However, before aborting, Python will also try to call
394-
PyUnstable_Object_Dump() on the given object. This may be of use when
394+
PyObject_Dump() on the given object. This may be of use when
395395
investigating bugs in which a particular object is corrupt (e.g. buggy a
396396
tp_visit method in an extension module breaking the garbage collector), to
397397
help locate the broken objects.

Include/internal/pycore_code.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ _PyCode_GetTLBCFast(PyThreadState *tstate, PyCodeObject *co)
563563

564564
// Return a pointer to the thread-local bytecode for the current thread,
565565
// creating it if necessary.
566-
extern _Py_CODEUNIT *_PyCode_GetTLBC(PyCodeObject *co);
566+
PyAPI_FUNC(_Py_CODEUNIT *) _PyCode_GetTLBC(PyCodeObject *co);
567567

568568
// Reserve an index for the current thread into thread-local bytecode
569569
// arrays

Include/internal/pycore_dict.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ extern Py_ssize_t _Py_dict_lookup_threadsafe_stackref(PyDictObject *mp, PyObject
114114

115115
extern int _PyDict_GetMethodStackRef(PyDictObject *dict, PyObject *name, _PyStackRef *method);
116116

117+
extern Py_ssize_t _PyDict_LookupIndexAndValue(PyDictObject *, PyObject *, PyObject **);
117118
extern Py_ssize_t _PyDict_LookupIndex(PyDictObject *, PyObject *);
118119
extern Py_ssize_t _PyDictKeys_StringLookup(PyDictKeysObject* dictkeys, PyObject *key);
119120

0 commit comments

Comments
 (0)