8000 Merge branch 'main' into monitoring-deinstrument-instruction · python/cpython@e4276a4 · GitHub
[go: up one dir, main page]

Skip to content

Commit e4276a4

Browse files
Merge branch 'main' into monitoring-deinstrument-instruction
2 parents 1ee5944 + 5dcbbd8 commit e4276a4

File tree

154 files changed

+4929
-3427
lines changed

Some content is hidden

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

154 files changed

+4929
-3427
lines changed

.cirrus.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@ freebsd_task:
1010
sysctl_script:
1111
- sysctl net.inet.tcp.blackhole=0
1212
- sysctl net.inet.udp.blackhole=0
13-
build_script:
13+
configure_script:
1414
- mkdir build
1515
- cd build
1616
- ../configure --with-pydebug
17+
build_script:
18+
- cd build
1719
- make -j$(sysctl -n hw.ncpu)
1820
pythoninfo_script:
19-
- cd build && make pythoninfo
21+
- cd build
22+
- make pythoninfo
2023
test_script:
2124
- cd build
2225
# dtrace fails to build on FreeBSD - see gh-73263

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ PC/classicAppCompat.* binary
2424
[attr]noeol -text
2525

2626
Lib/test/cjkencodings/* noeol
27-
Lib/test/coding20731.py noeol
27+
Lib/test/tokenizedata/coding20731.py noeol
2828
Lib/test/decimaltestdata/*.decTest noeol
2929
Lib/test/test_email/data/*.txt noeol
3030
Lib/test/test_importlib/resources/data01/* noeol

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
# pre-commit
1111
.pre-commit-config.yaml @hugovk @AlexWaygood
12+
.ruff.toml @hugovk @AlexWaygood
1213

1314
# Build system
1415
configure* @erlend-aasland @corona10

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
# into the PR branch anyway.
6464
#
6565
# https://github.com/python/core-workflow/issues/373
66-
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
66+
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc|^\.pre-commit-config\.yaml$|\.ruff\.toml$)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
6767
fi
6868
6969
# Check if we should run hypothesis tests

.github/workflows/lint.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on: [push, pull_request, workflow_dispatch]
55
permissions:
66
contents: read
77

8+
env:
9+
FORCE_COLOR: 1
10+
RUFF_FORMAT: github
11+
812
concurrency:
913
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1014
cancel-in-progress: true

.github/workflows/require-pr-label.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ on:
55
types: [opened, reopened, labeled, unlabeled, synchronize]
66

77
permissions:
8-
issues: read
9-
pull-requests: read
8+
issues: write
9+
pull-requests: write
1010

1111
jobs:
1212
label:

.pre-commit-config.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.0.288
4+
hooks:
5+
- id: ruff
6+
name: Run Ruff on Lib/test/
7+
args: [--exit-non-zero-on-fix]
8+
files: ^Lib/test/
9+
210
- repo: https://github.com/pre-commit/pre-commit-hooks
311
rev: v4.4.0
412
hooks:
13+
- id: check-toml
14+
exclude: ^Lib/test/test_tomllib/
515
- id: check-yaml
616
- id: end-of-file-fixer
717
types: [python]
8-
exclude: Lib/test/coding20731.py
18+
exclude: Lib/test/tokenizedata/coding20731.py
919
- id: trailing-whitespace
1020
types_or: [c, python, rst]
1121

Doc/library/dis.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,8 +1611,8 @@ iterations of the loop.
16111611
opcodes in the range [0,255] which don't use their argument and those
16121612
that do (``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively).
16131613

1614-
If your application uses pseudo instructions, use the :data:`hasarg`
1615-
collection instead.
1614+
If your application uses pseudo instructions or specialized instructions,
1615+
use the :data:`hasarg` collection instead.
16161616

16171617
.. versionchanged:: 3.6
16181618
Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT``
@@ -1623,6 +1623,8 @@ iterations of the loop.
16231623
it is not true that comparison with ``HAVE_ARGUMENT`` indicates whether
16241624
they use their arg.
16251625

1626+
.. deprecated:: 3.13
1627+
Use :data:`hasarg` instead.
16261628

16271629
.. opcode:: CALL_INTRINSIC_1
16281630

Doc/library/itertools.rst

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,7 @@ which incur interpreter overhead.
877877
yield i
878878
else:
879879
# Fast path for sequences
880+
stop = len(iterable) if stop is None else stop
880881
i = start - 1
881882
try:
882883
while True:
@@ -1030,13 +1031,16 @@ The following recipes have a more mathematical flavor:
10301031
def sieve(n):
10311032
"Primes less than n."
10321033
# sieve(30) --> 2 3 5 7 11 13 17 19 23 29
1034+
if n > 2:
1035+
yield 2
1036+
start = 3
10331037
data = bytearray((0, 1)) * (n // 2)
1034-
data[:3] = 0, 0, 0
10351038
limit = math.isqrt(n) + 1
1036-
for p in compress(range(limit), data):
1039+
for p in iter_index(data, 1, start, limit):
1040+
yield from iter_index(data, 1, start, p*p)
10371041
data[p*p : n : p+p] = bytes(len(range(p*p, n, p+p)))
1038-
data[2] = 1
1039-
return iter_index(data, 1) if n > 2 else iter([])
1042+
start = p*p
1043+
yield from iter_index(data, 1, start)
10401044

10411045
def factor(n):
10421046
"Prime factors of n."
@@ -1342,6 +1346,16 @@ The following recipes have a more mathematical flavor:
13421346
Traceback (most recent call last):
13431347
...
13441348
ValueError
1349+
>>> # Verify that both paths can find identical NaN values
1350+
>>> x = float('NaN')
1351+
>>> y = float('NaN')
1352+
>>> list(iter_index([0, x, x, y, 0], x))
1353+
[1, 2]
1354+
>>> list(iter_index(iter([0, x, x, y, 0]), x))
1355+
[1, 2]
1356+
>>> # Test list input. Lists do not support None for the stop argument
1357+
>>> list(iter_index(list('AABCADEAF'), 'A'))
1358+
[0, 1, 4, 7]
13451359

13461360
>>> list(sieve(30))
13471361
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]

Doc/library/msvcrt.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ Console I/O
9898

9999
.. function:: kbhit()
100100

101-
Return ``True`` if a keypress is waiting to be read.
101+
Returns a nonzero value if a keypress is waiting to be read. Otherwise,
102+
return 0.
102103

103104

104105
.. function:: getch()

Doc/library/traceback.rst

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,11 @@ The module defines the following functions:
139139

140140
Format the exception part of a traceback using an exception value such as
141141
given by ``sys.last_value``. The return value is a list of strings, each
142-
ending in a newline. Normally, the list contains a single string; however,
143-
for :exc:`SyntaxError` exceptions, it contains several lines that (when
144-
printed) display detailed information about where the syntax error occurred.
145-
The message indicating which exception occurred is the always last string in
146-
the list.
142+
ending in a newline. The list contains the exception's message, which is
143+
normally a single string; however, for :exc:`SyntaxError` exceptions, it
144+
contains several lines that (when printed) display detailed information
145+
about where the syntax error occurred. Following the message, the list
146+
contains the exception's :attr:`notes <BaseException.__notes__>`.
147147

148148
Since Python 3.10, instead of passing *value*, an exception object
149149
can be passed as the first argument. If *value* is provided, the first
@@ -153,6 +153,9 @@ The module defines the following functions:
153153
The *etype* parameter has been renamed to *exc* and is now
154154
positional-only.
155155

156+
.. versionchanged:: 3.11
157+
The returned list now includes any notes attached to the exception.
158+
156159

157160
.. function:: format_exception(exc, /[, value, tb], limit=None, chain=True)
158161

@@ -235,6 +238,12 @@ capture data for later printing in a lightweight fashion.
235238
group's exceptions array. The formatted output is truncated when either
236239
limit is exceeded.
237240

241+
.. versionchanged:: 3.10
242+
Added the *compact* parameter.
243+
244+
.. versionchanged:: 3.11
245+
Added the *max_group_width* and *max_group_depth* parameters.
246+
238247
.. attribute:: __cause__
239248

240249
A :class:`TracebackException` of the original ``__cause__``.
@@ -330,35 +339,28 @@ capture data for later printing in a lightweight fashion.
330339
some containing internal newlines. :func:`~traceback.print_exception`
331340
is a wrapper around this method which just prints the lines to a file.
332341

333-
The message indicating which exception occurred is always the last
334-
string in the output.
335-
336342
.. method:: format_exception_only(*, show_group=False)
337343

338344
Format the exception part of the traceback.
339345

340346
The return value is a generator of strings, each ending in a newline.
341347

342-
When *show_group* is ``False``, the generator normally emits a single
343-
string; however, for :exc:`SyntaxError` exceptions, it emits several
344-
lines that (when printed) display detailed information about where
345-
the syntax error occurred. The message indicating which exception
346-
occurred is always the last string in the output.
348+
When *show_group* is ``False``, the generator emits the exception's
349+
message followed by its notes (if it has any). The exception message
350+
is normally a single string; however, for :exc:`SyntaxError` exceptions,
351+
it consists of several lines that (when printed) display detailed
352+
information about where the syntax error occurred.
347353

348354
When *show_group* is ``True``, and the exception is an instance of
349355
:exc:`BaseExceptionGroup`, the nested exceptions are included as
350356
well, recursively, with indentation relative to their nesting depth.
351357

358+
.. versionchanged:: 3.11
359+
The exception's notes are now included in the output.
360+
352361
.. versionchanged:: 3.13
353362
Added the *show_group* parameter.
354363

355-
.. versionchanged:: 3.10
356-
Added the *compact* parameter.
357-
358-
.. versionchanged:: 3.11
359-
Added the *max_group_width* and *max_group_depth* parameters.
360-
361-
362364

363365
:class:`StackSummary` Objects
364366
-----------------------------

Doc/library/types.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,8 @@ Additional Utility Classes and Functions
504504
However, for a structured record type use :func:`~collections.namedtuple`
505505
instead.
506506

507+
:class:`!SimpleNamespace` objects are supported by :func:`copy.replace`.
508+
507509
.. versionadded:: 3.3
508510

509511
.. versionchanged:: 3.9

Doc/library/zipapp.rst

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,7 @@ The steps to create a standalone archive are as follows:
281281
file - if not, you can just list the dependencies manually on the pip command
282282
line).
283283

284-
3. Optionally, delete the ``.dist-info`` directories created by pip in the
285-
``myapp`` directory. These hold metadata for pip to manage the packages, and
286-
as you won't be making any further use of pip they aren't required -
287-
although it won't do any harm if you leave them.
288-
289-
4. Package the application using:
284+
3. Package the application using:
290285

291286
.. code-block:: shell-session
292287

Doc/tools/templates/indexcontent.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ <h1>{{ docstitle|e }}</h1>
6262
</td><td width="50%">
6363
<p class="biglink"><a class="biglink" href="{{ pathto("license") }}">{% trans %}History and License of Python{% endtrans %}</a></p>
6464
<p class="biglink"><a class="biglink" href="{{ pathto("copyright") }}">{% trans %}Copyright{% endtrans %}</a></p>
65+
<p class="biglink"><a class="biglink" href="{{ pathto("download") }}">{% trans %}Download the documentation{% endtrans %}</a></p>
6566
</td></tr>
6667
</table>
6768
{% endblock %}

0 commit comments

Comments
 (0)
0