Skip to content

Commit 816f34e

Browse files
Merge branch 'main' into htmlparser-cdata
2 parents f7f9f56 + da79ac9 commit 816f34e

File tree

375 files changed

+9152
-5081
lines changed

Some content is hidden

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

375 files changed

+9152
-5081
lines changed

.github/CODEOWNERS

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ Python/flowgraph.c @markshannon @iritkatriel
4545
Python/instruction_sequence.c @iritkatriel
4646
Python/bytecodes.c @markshannon
4747
Python/optimizer*.c @markshannon
48-
Python/optimizer_analysis.c @Fidget-Spinner
49-
Python/optimizer_bytecodes.c @Fidget-Spinner
48+
Python/optimizer_analysis.c @Fidget-Spinner @tomasr8
49+
Python/optimizer_bytecodes.c @Fidget-Spinner @tomasr8
50+
Python/optimizer_symbols.c @tomasr8
5051
Python/symtable.c @JelleZijlstra @carljm
5152
Lib/_pyrepl/* @pablogsal @lysnikolaou @ambv
5253
Lib/test/test_patma.py @brandtbucher
@@ -188,13 +189,13 @@ Include/internal/pycore_time.h @pganssle @abalkin
188189
/Tools/cases_generator/ @markshannon
189190

190191
# AST
191-
Python/ast.c @isidentical @JelleZijlstra @eclips4
192-
Python/ast_preprocess.c @isidentical @eclips4
193-
Parser/asdl.py @isidentical @JelleZijlstra @eclips4
194-
Parser/asdl_c.py @isidentical @JelleZijlstra @eclips4
195-
Lib/ast.py @isidentical @JelleZijlstra @eclips4
196-
Lib/_ast_unparse.py @isidentical @JelleZijlstra @eclips4
197-
Lib/test/test_ast/ @eclips4
192+
Python/ast.c @isidentical @JelleZijlstra @eclips4 @tomasr8
193+
Python/ast_preprocess.c @isidentical @eclips4 @tomasr8
194+
Parser/asdl.py @isidentical @JelleZijlstra @eclips4 @tomasr8
195+
Parser/asdl_c.py @isidentical @JelleZijlstra @eclips4 @tomasr8
196+
Lib/ast.py @isidentical @JelleZijlstra @eclips4 @tomasr8
197+
Lib/_ast_unparse.py @isidentical @JelleZijlstra @eclips4 @tomasr8
198+
Lib/test/test_ast/ @eclips4 @tomasr8
198199

199200
# Mock
200201
/Lib/unittest/mock.py @cjw296
@@ -341,3 +342,6 @@ Modules/_xxtestfuzz/ @ammaraskar
341342
Python/remote_debug.h @pablogsal
342343
Python/remote_debugging.c @pablogsal
343344
Modules/_remote_debugging_module.c @pablogsal @ambv @1st1
345+
346+
# gettext
347+
**/*gettext* @tomasr8

.github/workflows/build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,14 @@ jobs:
527527
config_hash: ${{ needs.build-context.outputs.config-hash }}
528528
free-threading: ${{ matrix.free-threading }}
529529

530+
build-ubsan:
531+
name: Undefined behavior sanitizer
532+
needs: build-context
533+
if: needs.build-context.outputs.run-tests == 'true'
534+
uses: ./.github/workflows/reusable-ubsan.yml
535+
with:
536+
config_hash: ${{ needs.build-context.outputs.config-hash }}
537+
530538
cross-build-linux:
531539
name: Cross build Linux
532540
runs-on: ubuntu-latest

.github/workflows/jit.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
- '**jit**'
66
- 'Python/bytecodes.c'
77
- 'Python/optimizer*.c'
8+
- 'Python/executor_cases.c.h'
9+
- 'Python/optimizer_cases.c.h'
810
- '!Python/perf_jit_trampoline.c'
911
- '!**/*.md'
1012
- '!**/*.ini'
@@ -13,6 +15,8 @@ on:
1315
- '**jit**'
1416
- 'Python/bytecodes.c'
1517
- 'Python/optimizer*.c'
18+
- 'Python/executor_cases.c.h'
19+
- 'Python/optimizer_cases.c.h'
1620
- '!Python/perf_jit_trampoline.c'
1721
- '!**/*.md'
1822
- '!**/*.ini'

.github/workflows/posix-deps-apt.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,10 @@ apt-get -yq install \
2525
uuid-dev \
2626
xvfb \
2727
zlib1g-dev
28+
29+
# Workaround missing libmpdec-dev on ubuntu 24.04:
30+
# https://launchpad.net/~ondrej/+archive/ubuntu/php
31+
# https://deb.sury.org/
32+
sudo add-apt-repository ppa:ondrej/php
33+
apt-get update
34+
apt-get -yq install libmpdec-dev

.github/workflows/reusable-ubsan.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Reusable Undefined Behavior Sanitizer
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
config_hash:
7+
required: true
8+
type: string
9+
10+
env:
11+
FORCE_COLOR: 1
12+
13+
jobs:
14+
build-ubsan-reusable:
15+
name: 'Undefined behavior sanitizer'
16+
runs-on: ubuntu-24.04
17+
timeout-minutes: 60
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
persist-credentials: false
22+
- name: Runner image version
23+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
24+
- name: Restore config.cache
25+
uses: actions/cache@v4
26+
with:
27+
path: config.cache
28+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ inputs.config_hash }}
29+
- name: Install dependencies
30+
run: |
31+
sudo ./.github/workflows/posix-deps-apt.sh
32+
# Install clang-20
33+
wget https://apt.llvm.org/llvm.sh
34+
chmod +x llvm.sh
35+
sudo ./llvm.sh 20
36+
- name: UBSAN option setup
37+
run: |
38+
echo "UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1" >> "$GITHUB_ENV"
39+
echo "CC=clang" >> "$GITHUB_ENV"
40+
echo "CXX=clang++" >> "$GITHUB_ENV"
41+
- name: Add ccache to PATH
42+
run: |
43+
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
44+
- name: Configure ccache action
45+
uses: hendrikmuhs/ccache-action@v1.2
46+
with:
47+
save: ${{ github.event_name == 'push' }}
48+
max-size: "200M"
49+
- name: Configure CPython
50+
run: >-
51+
./configure
52+
--config-cache
53+
--with-undefined-behavior-sanitizer
54+
--with-pydebug
55+
- name: Set up UBSAN log after configuration
56+
run: |
57+
echo "UBSAN_OPTIONS=${UBSAN_OPTIONS}:log_path=${GITHUB_WORKSPACE}/ubsan_log" >> "$GITHUB_ENV"
58+
- name: Build CPython
59+
run: make -j4
60+
- name: Display build info
61+
run: make pythoninfo
62+
- name: Tests
63+
run: ./python -m test -j4
64+
- name: Display UBSAN logs
65+
if: always()
66+
run: find "${GITHUB_WORKSPACE}" -name 'ubsan_log.*' | xargs head -n 1000
67+
- name: Archive UBSAN logs
68+
if: always()
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: >-
72+
ubsan-logs
73+
path: ubsan_log.*
74+
if-no-files-found: ignore

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ repos:
3434
name: Run Black on Tools/jit/
3535
files: ^Tools/jit/
3636

37+
- repo: https://github.com/Lucas-C/pre-commit-hooks
38+
rev: v1.5.5
39+
hooks:
40+
- id: remove-tabs
41+
types: [python]
42+
exclude: ^Tools/c-analyzer/cpython/_parser.py
43+
3744
- repo: https://github.com/pre-commit/pre-commit-hooks
3845
rev: v5.0.0
3946
hooks:

Doc/c-api/arg.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,12 @@ Building values
686686
``p`` (:class:`bool`) [int]
687687
Convert a C :c:expr:`int` to a Python :class:`bool` object.
688688
689+
Be aware that this format requires an ``int`` argument.
690+
Unlike most other contexts in C, variadic arguments are not coerced to
691+
a suitable type automatically.
692+
You can convert another type (for example, a pointer or a float) to a
693+
suitable ``int`` value using ``(x) ? 1 : 0`` or ``!!x``.
694+
689695
.. versionadded:: 3.14
690696
691697
``c`` (:class:`bytes` of length 1) [char]

Doc/c-api/capsule.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,19 @@ Refer to :ref:`using-capsules` for more information on using these objects.
105105
``module.attribute``. The *name* stored in the capsule must match this
106106
string exactly.
107107
108+
This function splits *name* on the ``.`` character, and imports the first
109+
element. It then processes further elements using attribute lookups.
110+
108111
Return the capsule's internal *pointer* on success. On failure, set an
109112
exception and return ``NULL``.
110113
114+
.. note::
115+
116+
If *name* points to an attribute of some submodule or subpackage, this
117+
submodule or subpackage must be previously imported using other means
118+
(for example, by using :c:func:`PyImport_ImportModule`) for the
119+
attribute lookups to succeed.
120+
111121
.. versionchanged:: 3.3
112122
*no_block* has no effect anymore.
113123

Doc/c-api/exceptions.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,16 @@ Exception Classes
749749
.. versionadded:: 3.2
750750
751751
752+
.. c:function:: int PyExceptionClass_Check(PyObject *ob)
753+
754+
Return non-zero if *ob* is an exception class, zero otherwise. This function always succeeds.
755+
756+
757+
.. c:function:: const char *PyExceptionClass_Name(PyObject *ob)
758+
759+
Return :c:member:`~PyTypeObject.tp_name` of the exception class *ob*.
760+
761+
752762
Exception Objects
753763
=================
754764

Doc/c-api/extension-modules.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,6 @@ in the following ways:
242242
* Single-phase modules support module lookup functions like
243243
:c:func:`PyState_FindModule`.
244244

245-
.. [#testsinglephase] ``_testsinglephase`` is an internal module used \
246-
in CPython's self-test suite; your installation may or may not \
245+
.. [#testsinglephase] ``_testsinglephase`` is an internal module used
246+
in CPython's self-test suite; your installation may or may not
247247
include it.

0 commit comments

Comments
 (0)