Skip to content

Commit 029a032

Browse files
authored
Merge branch 'main' into 132413-take2
2 parents c10d4db + dc4a707 commit 029a032

File tree

105 files changed

+2559
-1686
lines changed

Some content is hidden

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

105 files changed

+2559
-1686
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ Include/internal/pycore_time.h @pganssle @abalkin
167167
**/*imap* @python/email-team
168168
**/*poplib* @python/email-team
169169

170+
# Exclude .mailmap from being owned by @python/email-team
171+
/.mailmap
172+
170173
# Garbage collector
171174
/Modules/gcmodule.c @pablogsal
172175
/Doc/library/gc.rst @pablogsal

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# This file sets the canonical name for contributors to the repository.
22
# Documentation: https://git-scm.com/docs/gitmailmap
3+
Willow Chargin <[email protected]>
34

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.9.1
3+
rev: v0.11.4
44
hooks:
55
- id: ruff
66
name: Run Ruff (lint) on Doc/
@@ -11,9 +11,9 @@ repos:
1111
args: [--exit-non-zero-on-fix]
1212
files: ^Lib/test/
1313
- id: ruff
14-
name: Run Ruff (lint) on Tools/build/check_warnings.py
14+
name: Run Ruff (lint) on Tools/build/
1515
args: [--exit-non-zero-on-fix, --config=Tools/build/.ruff.toml]
16-
files: ^Tools/build/check_warnings.py
16+
files: ^Tools/build/
1717
- id: ruff
1818
name: Run Ruff (lint) on Argument Clinic
1919
args: [--exit-non-zero-on-fix, --config=Tools/clinic/.ruff.toml]

Doc/howto/perf_profiling.rst

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,28 @@ files in the current directory which are ELF images for all the JIT trampolines
254254
that were created by Python.
255255

256256
.. warning::
257-
Notice that when using ``--call-graph dwarf`` the ``perf`` tool will take
257+
When using ``--call-graph dwarf``, the ``perf`` tool will take
258258
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.
259+
information in the ``perf.data`` file. By default, the size of the stack dump
260+
is 8192 bytes, but you can change the size by passing it after
261+
a comma like ``--call-graph dwarf,16384``.
266262

263+
The size of the stack dump is important because if the size is too small
264+
``perf`` will not be able to unwind the stack and the output will be
265+
incomplete. On the other hand, if the size is too big, then ``perf`` won't
266+
be able to sample the process as frequently as it would like as the overhead
267+
will be higher.
268+
269+
The stack size is particularly important when profiling Python code compiled
270+
with low optimization levels (like ``-O0``), as these builds tend to have
271+
larger stack frames. If you are compiling Python with ``-O0`` and not seeing
272+
Python functions in your profiling output, try increasing the stack dump
273+
size to 65528 bytes (the maximum)::
274+
275+
$ perf record -F 9999 -g -k 1 --call-graph dwarf,65528 -o perf.data python -Xperf_jit my_script.py
276+
277+
Different compilation flags can significantly impact stack sizes:
278+
279+
- Builds with ``-O0`` typically have much larger stack frames than those with ``-O1`` or higher
280+
- Adding optimizations (``-O1``, ``-O2``, etc.) typically reduces stack size
281+
- Frame pointers (``-fno-omit-frame-pointer``) generally provide more reliable stack unwinding

Doc/library/dis.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,9 +1354,6 @@ iterations of the loop.
13541354
If ``STACK[-1]`` is not ``None``, increments the bytecode counter by *delta*.
13551355
``STACK[-1]`` is popped.
13561356

1357-
This opcode is a pseudo-instruction, replaced in final bytecode by
1358-
the directed versions (forward/backward).
1359-
13601357
.. versionadded:: 3.11
13611358

13621359
.. versionchanged:: 3.12
@@ -1368,9 +1365,6 @@ iterations of the loop.
13681365
If ``STACK[-1]`` is ``None``, increments the bytecode counter by *delta*.
13691366
``STACK[-1]`` is popped.
13701367

1371-
This opcode is a pseudo-instruction, replaced in final bytecode by
1372-
the directed versions (forward/backward).
1373-
13741368
.. versionadded:: 3.11
13751369

13761370
.. versionchanged:: 3.12

Doc/library/hashlib.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@
2020

2121
--------------
2222

23-
This module implements a common interface to many different secure hash and
24-
message digest algorithms. Included are the FIPS secure hash algorithms SHA1,
25-
SHA224, SHA256, SHA384, SHA512, (defined in `the FIPS 180-4 standard`_),
26-
the SHA-3 series (defined in `the FIPS 202 standard`_) as well as RSA's MD5
27-
algorithm (defined in internet :rfc:`1321`). The terms "secure hash" and
28-
"message digest" are interchangeable. Older algorithms were called message
29-
digests. The modern term is secure hash.
23+
This module implements a common interface to many different hash algorithms.
24+
Included are the FIPS secure hash algorithms SHA224, SHA256, SHA384, SHA512,
25+
(defined in `the FIPS 180-4 standard`_), the SHA-3 series (defined in `the FIPS
26+
202 standard`_) as well as the legacy algorithms SHA1 (`formerly part of FIPS`_)
27+
and the MD5 algorithm (defined in internet :rfc:`1321`).
3028

3129
.. note::
3230

@@ -812,6 +810,7 @@ Domain Dedication 1.0 Universal:
812810
.. _the FIPS 180-4 standard: https://csrc.nist.gov/pubs/fips/180-4/upd1/final
813811
.. _the FIPS 202 standard: https://csrc.nist.gov/pubs/fips/202/final
814812
.. _HACL\* project: https://github.com/hacl-star/hacl-star
813+
.. _formerly part of FIPS: https://csrc.nist.gov/news/2023/decision-to-revise-fips-180-4
815814

816815

817816
.. _hashlib-seealso:

Doc/library/itertools.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,12 @@ The following recipes have a more mathematical flavor:
10091009

10101010
.. testcode::
10111011

1012+
def multinomial(*counts):
1013+
"Number of distinct arrangements of a multiset."
1014+
# Counter('abracadabra').values() → 5 2 2 1 1
1015+
# multinomial(5, 2, 2, 1, 1) → 83160
1016+
return prod(map(comb, accumulate(counts), counts))
1017+
10121018
def powerset(iterable):
10131019
"Subsequences of the iterable from shortest to longest."
10141020
# powerset([1,2,3]) → () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)
@@ -1127,12 +1133,6 @@ The following recipes have a more mathematical flavor:
11271133
n -= n // prime
11281134
return n
11291135

1130-
def multinomial(*counts):
1131-
"Number of distinct arrangements of a multiset."
1132-
# Counter('abracadabra').values() → 5 2 2 1 1
1133-
# multinomial(5, 2, 2, 1, 1) → 83160
1134-
return prod(map(comb, accumulate(counts), counts))
1135-
11361136

11371137
.. doctest::
11381138
:hide:

Doc/library/shutil.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ Directory and files operations
473473
This is also applied when *cmd* is a path that contains a directory
474474
component::
475475

476-
>> shutil.which("C:\\Python33\\python")
476+
>>> shutil.which("C:\\Python33\\python")
477477
'C:\\Python33\\python.EXE'
478478

479479
.. versionadded:: 3.3

Doc/library/socket.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,9 @@ Constants
498498
.. versionchanged:: 3.11
499499
NetBSD support was added.
500500

501+
.. versionchanged:: next
502+
Restored missing ``CAN_RAW_ERR_FILTER`` on Linux.
503+
501504
.. data:: CAN_BCM
502505
CAN_BCM_*
503506

Doc/whatsnew/3.14.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,12 @@ Other language changes
479479
:func:`textwrap.dedent`.
480480
(Contributed by Jon Crall and Steven Sun in :gh:`103998`.)
481481

482+
* Improve error message when an object supporting the synchronous (resp.
483+
asynchronous) context manager protocol is entered using :keyword:`async
484+
with` (resp. :keyword:`with`) instead of :keyword:`with` (resp.
485+
:keyword:`async with`).
486+
(Contributed by Bénédikt Tran in :gh:`128398`.)
487+
482488

483489
.. _whatsnew314-pep765:
484490

@@ -819,6 +825,12 @@ json
819825
See the :ref:`JSON command-line interface <json-commandline>` documentation.
820826
(Contributed by Trey Hunner in :gh:`122873`.)
821827

828+
* By default, the output of the :ref:`JSON command-line interface <json-commandline>`
829+
is highlighted in color. This can be controlled via the
830+
:envvar:`PYTHON_COLORS` environment variable as well as the canonical
831+
|NO_COLOR|_ and |FORCE_COLOR|_ environment variables. See also
832+
:ref:`using-on-controlling-color`.
833+
(Contributed by Tomas Roun in :gh:`131952`.)
822834

823835
linecache
824836
---------

0 commit comments

Comments
 (0)