Skip to content

Commit 51c6cad

Browse files
authored
Merge branch 'main' into fix-c_powi-117999
2 parents c33836e + ec1398e commit 51c6cad

File tree

633 files changed

+10202
-6203
lines changed

Some content is hidden

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

633 files changed

+10202
-6203
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,11 @@ on:
88
push:
99
branches:
1010
- 'main'
11-
- '3.12'
12-
- '3.11'
13-
- '3.10'
14-
- '3.9'
15-
- '3.8'
11+
- '3.*'
1612
pull_request:
1713
branches:
1814
- 'main'
19-
- '3.12'
20-
- '3.11'
21-
- '3.10'
22-
- '3.9'
23-
- '3.8'
15+
- '3.*'
2416

2517
permissions:
2618
contents: read
@@ -218,7 +210,7 @@ jobs:
218210
with:
219211
config_hash: ${{ needs.check_source.outputs.config_hash }}
220212
free-threading: true
221-
# macos-14 is M1
213+
# macos-14-large is Intel with 12 cores (most parallelism)
222214
os-matrix: '["macos-14"]'
223215

224216
build_ubuntu:
@@ -494,6 +486,7 @@ jobs:
494486
config_hash: ${{ needs.check_source.outputs.config_hash }}
495487
options: ./configure --config-cache --with-thread-sanitizer --with-pydebug
496488
suppressions_path: Tools/tsan/supressions.txt
489+
tsan_logs_artifact_name: tsan-logs-default
497490

498491
build_tsan_free_threading:
499492
name: 'Thread sanitizer (free-threading)'
@@ -504,6 +497,7 @@ jobs:
504497
config_hash: ${{ needs.check_source.outputs.config_hash }}
505498
options: ./configure --config-cache --disable-gil --with-thread-sanitizer --with-pydebug
506499
suppressions_path: Tools/tsan/suppressions_free_threading.txt
500+
tsan_logs_artifact_name: tsan-logs-free-threading
507501

508502
# CIFuzz job based on https://google.github.io/oss-fuzz/getting-started/continuous-integration/
509503
cifuzz:

.github/workflows/jit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
jit:
2424
name: ${{ matrix.target }} (${{ matrix.debug && 'Debug' || 'Release' }})
2525
runs-on: ${{ matrix.runner }}
26-
timeout-minutes: 75
26+
timeout-minutes: 90
2727
strategy:
2828
fail-fast: false
2929
matrix:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ apt-get -yq install \
1515
libgdbm-dev \
1616
libgdbm-compat-dev \
1717
liblzma-dev \
18+
libmpdec-dev \
1819
libncurses5-dev \
1920
libreadline6-dev \
2021
libsqlite3-dev \

.github/workflows/reusable-macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
--prefix=/opt/python-dev \
5151
--with-openssl="$(brew --prefix [email protected])"
5252
- name: Build CPython
53-
run: make -j4
53+
run: make -j8
5454
- name: Display build info
5555
run: make pythoninfo
5656
- name: Tests

.github/workflows/reusable-tsan.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
description: 'A repo relative path to the suppressions file'
1212
required: true
1313
type: string
14+
tsan_logs_artifact_name:
15+
description: 'Name of the TSAN logs artifact. Must be unique for each job.'
16+
required: true
17+
type: string
1418

1519
jobs:
1620
build_tsan_reusable:
@@ -29,12 +33,19 @@ jobs:
2933
- name: Install Dependencies
3034
run: |
3135
sudo ./.github/workflows/posix-deps-apt.sh
32-
sudo apt install -y clang
36+
# Install clang-18
37+
wget https://apt.llvm.org/llvm.sh
38+
chmod +x llvm.sh
39+
sudo ./llvm.sh 18
40+
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100
41+
sudo update-alternatives --set clang /usr/bin/clang-18
42+
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100
43+
sudo update-alternatives --set clang++ /usr/bin/clang++-18
3344
# Reduce ASLR to avoid TSAN crashing
3445
sudo sysctl -w vm.mmap_rnd_bits=28
3546
- name: TSAN Option Setup
3647
run: |
37-
echo "TSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/${{ inputs.suppressions_path }}" >> $GITHUB_ENV
48+
echo "TSAN_OPTIONS=log_path=${GITHUB_WORKSPACE}/tsan_log suppressions=${GITHUB_WORKSPACE}/${{ inputs.suppressions_path }} handle_segv=0" >> $GITHUB_ENV
3849
echo "CC=clang" >> $GITHUB_ENV
3950
echo "CXX=clang++" >> $GITHUB_ENV
4051
- name: Add ccache to PATH
@@ -53,3 +64,13 @@ jobs:
5364
run: make pythoninfo
5465
- name: Tests
5566
run: ./python -m test --tsan -j4
67+
- name: Display TSAN logs
68+
if: always()
69+
run: find ${GITHUB_WORKSPACE} -name 'tsan_log.*' | xargs head -n 1000
70+
- name: Archive TSAN logs
71+
if: always()
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: ${{ inputs.tsan_logs_artifact_name }}
75+
path: tsan_log.*
76+
if-no-files-found: ignore

Doc/c-api/init_config.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,10 +1250,10 @@ PyConfig
12501250
If non-zero, initialize the perf trampoline. See :ref:`perf_profiling`
12511251
for more information.
12521252
1253-
Set by :option:`-X perf <-X>` command line option and by the
1254-
:envvar:`PYTHONPERFSUPPORT` environment variable for perf support
1255-
with stack pointers and :option:`-X perfjit <-X>` command line option
1256-
and by the :envvar:`PYTHONPERFJITSUPPORT` environment variable for perf
1253+
Set by :option:`-X perf <-X>` command-line option and by the
1254+
:envvar:`PYTHON_PERF_JIT_SUPPORT` environment variable for perf support
1255+
with stack pointers and :option:`-X perf_jit <-X>` command-line option
1256+
and by the :envvar:`PYTHON_PERF_JIT_SUPPORT` environment variable for perf
12571257
support with DWARF JIT information.
12581258
12591259
Default: ``-1``.

Doc/c-api/module.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ state:
634634
635635
.. versionadded:: 3.9
636636
637-
.. c:function:: int PyModule_ExperimentalSetGIL(PyObject *module, void *gil)
637+
.. c:function:: int PyUnstable_Module_SetGIL(PyObject *module, void *gil)
638638
639639
Indicate that *module* does or does not support running without the global
640640
interpreter lock (GIL), using one of the values from

Doc/c-api/object.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Object Protocol
6565
6666
Properly handle returning :c:data:`Py_NotImplemented` from within a C
6767
function (that is, create a new :term:`strong reference`
68-
to NotImplemented and return it).
68+
to :const:`NotImplemented` and return it).
6969
7070
7171
.. c:macro:: Py_PRINT_RAW

Doc/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,10 @@
435435
epub_author = 'Python Documentation Authors'
436436
epub_publisher = 'Python Software Foundation'
437437

438+
# index pages are not valid xhtml
439+
# https://github.com/sphinx-doc/sphinx/issues/12359
440+
epub_use_index = False
441+
438442
# Options for the coverage checker
439443
# --------------------------------
440444

Doc/howto/perf_profiling.rst

Lines changed: 50 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,12 @@ the :option:`!-X` option takes precedence over the environment variable.
162162

163163
Example, using the environment variable::
164164

165-
$ PYTHONPERFSUPPORT=1 python script.py
165+
$ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python script.py
166166
$ perf report -g -i perf.data
167167

168168
Example, using the :option:`!-X` option::
169169

170-
$ python -X perf script.py
170+
$ perf record -F 9999 -g -o perf.data python -X perf script.py
171171
$ perf report -g -i perf.data
172172

173173
Example, using the :mod:`sys` APIs in file :file:`example.py`:
@@ -184,7 +184,7 @@ Example, using the :mod:`sys` APIs in file :file:`example.py`:
184184
185185
...then::
186186

187-
$ python ./example.py
187+
$ perf record -F 9999 -g -o perf.data python ./example.py
188188
$ perf report -g -i perf.data
189189

190190

@@ -210,31 +210,57 @@ of ``perf``.
210210
How to work without frame pointers
211211
----------------------------------
212212

213-
If you are working with a Python interpreter that has been compiled without frame pointers
214-
you can still use the ``perf`` profiler but the overhead will be a bit higher because Python
215-
needs to generate unwinding information for every Python function call on the fly. Additionally,
216-
``perf`` will take more time to process the data because it will need to use the DWARF debugging
217-
information to unwind the stack and this is a slow process.
213+
If you are working with a Python interpreter that has been compiled without
214+
frame pointers, you can still use the ``perf`` profiler, but the overhead will be
215+
a bit higher because Python needs to generate unwinding information for every
216+
Python function call on the fly. Additionally, ``perf`` will take more time to
217+
process the data because it will need to use the DWARF debugging information to
218+
unwind the stack and this is a slow process.
218219

219-
To enable this mode, you can use the environment variable :envvar:`PYTHONPERFJITSUPPORT` or the
220-
:option:`-X perfjit <-X>` option, which will enable the JIT mode for the ``perf`` profiler.
220+
To enable this mode, you can use the environment variable
221+
:envvar:`PYTHON_PERF_JIT_SUPPORT` or the :option:`-X perf_jit <-X>` option,
222+
which will enable the JIT mode for the ``perf`` profiler.
221223

222-
When using the perf JIT mode, you need an extra step before you can run ``perf report``. You need to
223-
call the ``perf inject`` command to inject the JIT information into the ``perf.data`` file.
224+
.. note::
224225

225-
$ perf record -F 9999 -g --call-graph dwarf -o perf.data python -Xperfjit my_script.py
226-
$ perf inject -i perf.data --jit
227-
$ perf report -g -i perf.data
226+
Due to a bug in the ``perf`` tool, only ``perf`` versions higher than v6.8
227+
will work with the JIT mode. The fix was also backported to the v6.7.2
228+
version of the tool.
228229

229-
or using the environment variable::
230+
Note that when checking the version of the ``perf`` tool (which can be done
231+
by running ``perf version``) you must take into account that some distros
232+
add some custom version numbers including a ``-`` character. This means
233+
that ``perf 6.7-3`` is not necessarily ``perf 6.7.3``.
234+
235+
When using the perf JIT mode, you need an extra step before you can run ``perf
236+
report``. You need to call the ``perf inject`` command to inject the JIT
237+
information into the ``perf.data`` file.::
230238

231-
$ PYTHONPERFJITSUPPORT=1 perf record -F 9999 -g --call-graph dwarf -o perf.data python my_script.py
232-
$ perf inject -i perf.data --jit
233-
$ perf report -g -i perf.data
239+
$ perf record -F 9999 -g --call-graph dwarf -o perf.data python -Xperf_jit my_script.py
240+
$ perf inject -i perf.data --jit --output perf.jit.data
241+
$ perf report -g -i perf.jit.data
242+
243+
or using the environment variable::
234244

235-
Notice that when using ``--call-graph dwarf`` the ``perf`` tool will take snapshots of the stack of
236-
the process being profiled and save the information in the ``perf.data`` file. By default the size of
237-
the stack dump is 8192 bytes but the user can change the size by passing the size after comma like
238-
``--call-graph dwarf,4096``. The size of the stack dump is important because if the size is too small
239-
``perf`` will not be able to unwind the stack and the output will be incomplete.
245+
$ PYTHON_PERF_JIT_SUPPORT=1 perf record -F 9999 -g --call-graph dwarf -o perf.data python my_script.py
246+
$ perf inject -i perf.data --jit --output perf.jit.data
247+
$ perf report -g -i perf.jit.data
248+
249+
``perf inject --jit`` command will read ``perf.data``,
250+
automatically pick up the perf dump file that Python creates (in
251+
``/tmp/perf-$PID.dump``), and then create ``perf.jit.data`` which merges all the
252+
JIT information together. It should also create a lot of ``jitted-XXXX-N.so``
253+
files in the current directory which are ELF images for all the JIT trampolines
254+
that were created by Python.
255+
256+
.. warning::
257+
Notice that when using ``--call-graph dwarf`` the ``perf`` tool will take
258+
snapshots of the stack of the process being profiled and save the
259+
information in the ``perf.data`` file. By default the size of the stack dump
260+
is 8192 bytes but the user can change the size by passing the size after
261+
comma like ``--call-graph dwarf,4096``. The size of the stack dump is
262+
important because if the size is too small ``perf`` will not be able to
263+
unwind the stack and the output will be incomplete. On the other hand, if
264+
the size is too big, then ``perf`` won't be able to sample the process as
265+
frequently as it would like as the overhead will be higher.
240266

Doc/howto/urllib2.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,5 +594,5 @@ This document was reviewed and revised by John Lee.
594594
scripts with a localhost server, I have to prevent urllib from using
595595
the proxy.
596596
.. [#] urllib opener for SSL proxy (CONNECT method): `ASPN Cookbook Recipe
597-
<https://code.activestate.com/recipes/456195/>`_.
597+
<https://code.activestate.com/recipes/456195-urrlib2-opener-for-ssl-proxy-connect-method/>`_.
598598

Doc/library/__future__.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
:mod:`__future__` --- Future statement definitions
2-
==================================================
1+
:mod:`!__future__` --- Future statement definitions
2+
===================================================
33

44
.. module:: __future__
55
:synopsis: Future statement definitions

Doc/library/__main__.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
:mod:`__main__` --- Top-level code environment
2-
==============================================
1+
:mod:`!__main__` --- Top-level code environment
2+
===============================================
33

44
.. module:: __main__
55
:synopsis: The environment where top-level code is run. Covers command-line

Doc/library/_thread.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
:mod:`_thread` --- Low-level threading API
2-
==========================================
1+
:mod:`!_thread` --- Low-level threading API
2+
===========================================
33

44
.. module:: _thread
55
:synopsis: Low-level threading API.
@@ -169,14 +169,14 @@ Lock objects have the following methods:
169169
time can acquire a lock --- that's their reason for existence).
170170

171171
If the *blocking* argument is present, the action depends on its
172-
value: if it is False, the lock is only acquired if it can be acquired
173-
immediately without waiting, while if it is True, the lock is acquired
172+
value: if it is false, the lock is only acquired if it can be acquired
173+
immediately without waiting, while if it is true, the lock is acquired
174174
unconditionally as above.
175175

176176
If the floating-point *timeout* argument is present and positive, it
177177
specifies the maximum wait time in seconds before returning. A negative
178178
*timeout* argument specifies an unbounded wait. You cannot specify
179-
a *timeout* if *blocking* is False.
179+
a *timeout* if *blocking* is false.
180180

181181
The return value is ``True`` if the lock is acquired successfully,
182182
``False`` if not.

Doc/library/abc.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
:mod:`abc` --- Abstract Base Classes
2-
====================================
1+
:mod:`!abc` --- Abstract Base Classes
2+
=====================================
33

44
.. module:: abc
55
:synopsis: Abstract base classes according to :pep:`3119`.

Doc/library/allos.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ but they are available on most other systems as well. Here's an overview:
1616
io.rst
1717
time.rst
1818
argparse.rst
19-
getopt.rst
2019
logging.rst
2120
logging.config.rst
2221
logging.handlers.rst

Doc/library/argparse.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
:mod:`argparse` --- Parser for command-line options, arguments and sub-commands
2-
===============================================================================
1+
:mod:`!argparse` --- Parser for command-line options, arguments and sub-commands
2+
================================================================================
33

44
.. module:: argparse
55
:synopsis: Command-line option and argument parsing library.

Doc/library/array.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
:mod:`array` --- Efficient arrays of numeric values
2-
===================================================
1+
:mod:`!array` --- Efficient arrays of numeric values
2+
====================================================
33

44
.. module:: array
55
:synopsis: Space efficient arrays of uniformly typed numeric values.

0 commit comments

Comments
 (0)