Skip to content

Commit 8d0fbe0

Browse files
Merge branch 'main' into fix-issue-118524-match-union
2 parents bfe29ef + c4f9823 commit 8d0fbe0

33 files changed

+888
-711
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ jobs:
208208
with:
209209
config_hash: ${{ needs.check_source.outputs.config_hash }}
210210
# macos-14 is M1, macos-13 is Intel
211-
os-matrix: '["macos-14-xlarge", "macos-13-large"]'
211+
os-matrix: '["macos-14", "macos-13"]'
212212

213213
build_macos_free_threading:
214214
name: 'macOS (free-threading)'
@@ -219,7 +219,7 @@ jobs:
219219
config_hash: ${{ needs.check_source.outputs.config_hash }}
220220
free-threading: true
221221
# macos-14-large is Intel with 12 cores (most parallelism)
222-
os-matrix: '["macos-14-large"]'
222+
os-matrix: '["macos-14"]'
223223

224224
build_ubuntu:
225225
name: 'Ubuntu'

Doc/howto/perf_profiling.rst

Lines changed: 48 additions & 22 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:`PYTHON_PERF_JIT_SUPPORT` or the
220-
:option:`-X perf_jit <-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::
225+
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.
229+
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.::
224238

225239
$ perf record -F 9999 -g --call-graph dwarf -o perf.data python -Xperf_jit my_script.py
226-
$ perf inject -i perf.data --jit
227-
$ perf report -g -i perf.data
240+
$ perf inject -i perf.data --jit --output perf.jit.data
241+
$ perf report -g -i perf.jit.data
228242

229243
or using the environment variable::
230244

231245
$ PYTHON_PERF_JIT_SUPPORT=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
234-
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.
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/collections.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ The class can be used to simulate nested scopes and is useful in templating.
134134
:attr:`~collections.ChainMap.parents` property.
135135

136136
* The `Nested Contexts recipe
137-
<https://code.activestate.com/recipes/577434/>`_ has options to control
137+
<https://code.activestate.com/recipes/577434-nested-contexts-a-chain-of-mapping-objects/>`_ has options to control
138138
whether writes and other mutations apply only to the first mapping or to
139139
any mapping in the chain.
140140

Doc/library/difflib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ If you want to know how to change the first sequence into the second, use
631631
work.
632632

633633
* `Simple version control recipe
634-
<https://code.activestate.com/recipes/576729/>`_ for a small application
634+
<https://code.activestate.com/recipes/576729-simple-version-control/>`_ for a small application
635635
built with :class:`SequenceMatcher`.
636636

637637

Doc/library/enum.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,9 +861,15 @@ Supported ``_sunder_`` names
861861
For :class:`Flag` classes the next value chosen will be the next highest
862862
power-of-two.
863863

864+
- While ``_sunder_`` names are generally reserved for the further development
865+
of the :class:`Enum` class and can not be used, some are explicitly allowed:
866+
867+
- ``_repr_*`` (e.g. ``_repr_html_``), as used in `IPython's rich display`_
868+
864869
.. versionadded:: 3.6 ``_missing_``, ``_order_``, ``_generate_next_value_``
865870
.. versionadded:: 3.7 ``_ignore_``
866-
.. versionadded:: 3.13 ``_add_alias_``, ``_add_value_alias_``
871+
.. versionadded:: 3.13 ``_add_alias_``, ``_add_value_alias_``, ``_repr_*``
872+
.. _`IPython's rich display`: https://ipython.readthedocs.io/en/stable/config/integrating.html#rich-display
867873

868874
---------------
869875

Doc/library/math.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Number-theoretic and representation functions
134134

135135
For further discussion and two alternative approaches, see the `ASPN cookbook
136136
recipes for accurate floating point summation
137-
<https://code.activestate.com/recipes/393090/>`_\.
137+
<https://code.activestate.com/recipes/393090-binary-floating-point-summation-accurate-to-full-p/>`_\.
138138

139139

140140
.. function:: gcd(*integers)

Doc/library/random.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ from sources provided by the operating system.
5555

5656

5757
`Complementary-Multiply-with-Carry recipe
58-
<https://code.activestate.com/recipes/576707/>`_ for a compatible alternative
58+
<https://code.activestate.com/recipes/576707-long-period-random-number-generator/>`_ for a compatible alternative
5959
random number generator with a long period and comparatively simple update
6060
operations.
6161

Doc/library/shelve.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Two additional methods are supported:
8686

8787
.. seealso::
8888

89-
`Persistent dictionary recipe <https://code.activestate.com/recipes/576642/>`_
89+
`Persistent dictionary recipe <https://code.activestate.com/recipes/576642-persistent-dict-with-multiple-standard-file-format/>`_
9090
with widely supported storage formats and having the speed of native
9191
dictionaries.
9292

Doc/library/stdtypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1496,7 +1496,7 @@ objects that compare equal might have different :attr:`~range.start`,
14961496

14971497
.. seealso::
14981498

1499-
* The `linspace recipe <https://code.activestate.com/recipes/579000/>`_
1499+
* The `linspace recipe <https://code.activestate.com/recipes/579000-equally-spaced-numbers-linspace/>`_
15001500
shows how to implement a lazy version of range suitable for floating
15011501
point applications.
15021502

0 commit comments

Comments
 (0)