Skip to content

Commit 2abdd22

Browse files
authored
Merge branch 'python:main' into gh-149180-empty-tp-as-structs
2 parents 3f51f2d + 3efd2f4 commit 2abdd22

53 files changed

Lines changed: 3198 additions & 441 deletions

Some content is hidden

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

.github/workflows/build.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,13 @@ jobs:
278278
# unsupported as it most resembles other 1.1.1-work-a-like ssl APIs
279279
# supported by important vendors such as AWS-LC.
280280
- { name: openssl, version: 1.1.1w }
281-
- { name: openssl, version: 3.0.19 }
282-
- { name: openssl, version: 3.3.6 }
283-
- { name: openssl, version: 3.4.4 }
284-
- { name: openssl, version: 3.5.5 }
285-
- { name: openssl, version: 3.6.1 }
281+
- { name: openssl, version: 3.0.20 }
282+
- { name: openssl, version: 3.3.7 }
283+
- { name: openssl, version: 3.4.5 }
284+
- { name: openssl, version: 3.5.6 }
285+
- { name: openssl, version: 3.6.2 }
286286
## AWS-LC
287-
- { name: aws-lc, version: 1.68.0 }
287+
- { name: aws-lc, version: 1.72.1 }
288288
env:
289289
SSLLIB_VER: ${{ matrix.ssllib.version }}
290290
MULTISSL_DIR: ${{ github.workspace }}/multissl
@@ -398,7 +398,7 @@ jobs:
398398
needs: build-context
399399
if: needs.build-context.outputs.run-ubuntu == 'true'
400400
env:
401-
OPENSSL_VER: 3.5.5
401+
OPENSSL_VER: 3.5.6
402402
PYTHONSTRICTEXTENSIONBUILD: 1
403403
steps:
404404
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -506,7 +506,7 @@ jobs:
506506
matrix:
507507
os: [ubuntu-24.04]
508508
env:
509-
OPENSSL_VER: 3.5.5
509+
OPENSSL_VER: 3.5.6
510510
PYTHONSTRICTEXTENSIONBUILD: 1
511511
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
512512
steps:

.github/workflows/reusable-ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
runs-on: ${{ inputs.os }}
3636
timeout-minutes: 60
3737
env:
38-
OPENSSL_VER: 3.5.5
38+
OPENSSL_VER: 3.5.6
3939
PYTHONSTRICTEXTENSIONBUILD: 1
4040
TERM: linux
4141
steps:

Doc/deprecations/pending-removal-in-3.18.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ Pending removal in Python 3.18
1010
specifier ``'N'``, which is only supported in the :mod:`!decimal` module's
1111
C implementation, has been deprecated since Python 3.13.
1212
(Contributed by Serhiy Storchaka in :gh:`89902`.)
13+
14+
* Deprecations defined by :pep:`829`:
15+
16+
* ``import`` lines in :file:`{name}.pth` files are silently ignored.
17+
18+
(Contributed by Barry Warsaw in :gh:`148641`.)

Doc/deprecations/pending-removal-in-3.20.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ Pending removal in Python 3.20
3939

4040
(Contributed by Hugo van Kemenade and Stan Ulbrych in :gh:`76007`.)
4141

42+
* Deprecations defined by :pep:`829`:
43+
44+
* Warnings are produced for ``import`` lines found in :file:`{name}.pth`
45+
files.
46+
47+
* :file:`{name}.pth` files are no longer decoded in the locale encoding by
48+
default. They **MUST** be encoded in ``utf-8-sig``.
49+
50+
(Contributed by Barry Warsaw in :gh:`148641`.)
51+
4252
* :mod:`ast`:
4353

4454
* Creating instances of abstract AST nodes (such as :class:`ast.AST`

Doc/library/http.server.rst

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,8 @@ instantiation, of which this module provides three different variants:
366366
delays, it now always returns the IP address.
367367

368368

369-
.. class:: SimpleHTTPRequestHandler(request, client_address, server, directory=None)
369+
.. class:: SimpleHTTPRequestHandler(request, client_address, server, \
370+
*, directory=None, extra_response_headers=None)
370371
371372
This class serves files from the directory *directory* and below,
372373
or the current directory if *directory* is not provided, directly
@@ -378,6 +379,9 @@ instantiation, of which this module provides three different variants:
378379
.. versionchanged:: 3.9
379380
The *directory* parameter accepts a :term:`path-like object`.
380381

382+
.. versionchanged:: next
383+
Added *extra_response_headers* parameter.
384+
381385
A lot of the work, such as parsing the request, is done by the base class
382386
:class:`BaseHTTPRequestHandler`. This class implements the :func:`do_GET`
383387
and :func:`do_HEAD` functions.
@@ -408,6 +412,15 @@ instantiation, of which this module provides three different variants:
408412
This dictionary is no longer filled with the default system mappings,
409413
but only contains overrides.
410414

415+
.. attribute:: extra_response_headers
416+
417+
A sequence of ``(name, value)`` pairs containing user-defined extra HTTP
418+
response headers to add to each successful HTTP status 200 response. These
419+
headers are not included in other status code responses.
420+
421+
Headers that the server sends automatically such as ``Content-Type``
422+
will not be overwritten by :attr:`!extra_response_headers`.
423+
411424
The :class:`SimpleHTTPRequestHandler` class defines the following methods:
412425

413426
.. method:: do_HEAD()
@@ -440,6 +453,9 @@ instantiation, of which this module provides three different variants:
440453
followed by a ``'Content-Length:'`` header with the file's size and a
441454
``'Last-Modified:'`` header with the file's modification time.
442455

456+
The instance attribute :attr:`extra_response_headers` is a sequence of
457+
``(name, value)`` pairs containing user-defined extra response headers.
458+
443459
Then follows a blank line signifying the end of the headers, and then the
444460
contents of the file are output.
445461

@@ -581,6 +597,15 @@ The following options are accepted:
581597

582598
.. versionadded:: 3.14
583599

600+
.. option:: -H, --header <header> <value>
601+
602+
Specify an additional extra HTTP Response Header to send on successful HTTP
603+
200 responses. Can be used multiple times to send additional custom response
604+
headers. Headers that are sent automatically by the server (for instance
605+
Content-Type) will not be overwritten by the server.
606+
607+
.. versionadded:: next
608+
584609

585610
.. _http.server-security:
586611

Doc/library/pkgutil.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ support.
194194
The :mod:`importlib.resources` module provides structured access to
195195
module resources.
196196

197-
.. function:: resolve_name(name)
197+
.. function:: resolve_name(name, *, strict=False)
198198

199199
Resolve a name to an object.
200200

@@ -208,6 +208,7 @@ support.
208208

209209
* ``W(.W)*``
210210
* ``W(.W)*:(W(.W)*)?``
211+
* ``W(.W)*:(W(.W)*)``
211212

212213
The first form is intended for backward compatibility only. It assumes that
213214
some part of the dotted name is a package, and the rest is an object
@@ -222,6 +223,11 @@ support.
222223
hierarchy within that package. Only one import is needed in this form. If
223224
it ends with the colon, then a module object is returned.
224225

226+
The first two forms are accepted when ``strict=False`` (the default).
227+
228+
The third form requires both the module name and callable, separated by
229+
a colon. Only this form is accepted when ``strict=True``.
230+
225231
The function will return an object (which might be a module), or raise one
226232
of the following exceptions:
227233

@@ -233,3 +239,7 @@ support.
233239
hierarchy within the imported package to get to the desired object.
234240

235241
.. versionadded:: 3.9
242+
243+
.. versionchanged:: 3.15
244+
245+
The optional keyword-only ``strict`` flag was added.

Doc/library/profiling.sampling.rst

Lines changed: 120 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ Attach to a running process by PID::
153153

154154
python -m profiling.sampling attach 12345
155155

156+
Print a single snapshot of a running process's stack::
157+
158+
python -m profiling.sampling dump 12345
159+
156160
Use live mode for real-time monitoring (press ``q`` to quit)::
157161

158162
python -m profiling.sampling run --live script.py
@@ -173,8 +177,9 @@ Enable opcode-level profiling to see which bytecode instructions are executing::
173177
Commands
174178
========
175179

176-
Tachyon operates through two subcommands that determine how to obtain the
177-
target process.
180+
Tachyon operates through several subcommands. ``run`` and ``attach`` collect
181+
samples over time; ``dump`` captures a single snapshot; ``replay`` converts
182+
binary profiles to other formats.
178183

179184

180185
The ``run`` command
@@ -217,6 +222,78 @@ On most systems, attaching to another process requires appropriate permissions.
217222
See :ref:`profiling-permissions` for platform-specific requirements.
218223

219224

225+
.. _dump-command:
226+
227+
The ``dump`` command
228+
--------------------
229+
230+
The ``dump`` command prints a single snapshot of a running process's Python
231+
stack and exits, similar to a traceback::
232+
233+
python -m profiling.sampling dump 12345
234+
235+
Unlike ``attach``, ``dump`` does not run a sampling loop: it reads the
236+
stack once. This is useful for investigating hung or unresponsive
237+
processes, or for answering "what is this process doing right now?".
238+
239+
The output mirrors a traceback (most recent call last) and annotates each
240+
thread with its current state (main thread, has GIL, on CPU, waiting for
241+
GIL, has exception, or idle):
242+
243+
.. code-block:: text
244+
245+
Stack dump for PID 12345, thread 140735 (main thread, has GIL, on CPU; most recent call last):
246+
File "server.py", line 28, in serve
247+
await handle_request(req)
248+
File "handler.py", line 91, in handle_request
249+
result = expensive_call(req)
250+
251+
When the target's source files are readable, ``dump`` prints the source
252+
line for each frame and highlights the executing expression.
253+
254+
Like ``attach``, ``dump`` requires permission to read the target process's
255+
memory. See :ref:`profiling-permissions`.
256+
257+
The ``dump`` command supports the following options:
258+
259+
``-a``, ``--all-threads``
260+
Dump every thread in the target process. Without this flag only the main
261+
thread is shown.
262+
263+
``--native``
264+
Include synthetic ``<native>`` frames marking transitions into C
265+
extensions or other non-Python code.
266+
267+
``--no-gc``
268+
Hide the synthetic ``<GC>`` frames that mark active garbage collection.
269+
270+
``--opcodes``
271+
Annotate each frame with the bytecode opcode the thread is currently
272+
executing (for example, ``opcode=CALL_KW``). Useful for
273+
instruction-level investigation, including identifying specializations
274+
chosen by the adaptive interpreter.
275+
276+
``--async-aware``
277+
Reconstruct stacks across ``await`` boundaries. ``dump`` walks the task
278+
graph and emits one section per task, with ``<task>`` markers separating
279+
coroutines awaiting each other.
280+
281+
``--async-mode {running,all}``
282+
Controls which tasks are included when ``--async-aware`` is enabled.
283+
``running`` shows only the task currently executing on each thread;
284+
``all`` (the default for ``dump``) also includes tasks suspended on a
285+
wait. ``attach``'s default for this flag is ``running``; ``dump``
286+
defaults to ``all`` because a single snapshot is most useful when it
287+
shows the full task graph.
288+
289+
``--blocking``
290+
Pause every thread in the target while reading its stack and resume
291+
them after. Guarantees a fully consistent snapshot at the cost of
292+
briefly stopping the target. Without it, ``dump`` reads memory while
293+
the target keeps running, which is faster but can occasionally produce
294+
a torn stack.
295+
296+
220297
.. _replay-command:
221298

222299
The ``replay`` command
@@ -1441,11 +1518,52 @@ Global options
14411518

14421519
Attach to and profile a running process by PID.
14431520

1521+
.. option:: dump
1522+
1523+
Print a single one-shot snapshot of a running process's Python stack.
1524+
14441525
.. option:: replay
14451526

14461527
Convert a binary profile file to another output format.
14471528

14481529

1530+
Dump options
1531+
------------
1532+
1533+
The following options apply to the ``dump`` subcommand:
1534+
1535+
.. option:: -a, --all-threads
1536+
1537+
Dump all threads in the target process instead of just the main thread.
1538+
1539+
.. option:: --native
1540+
1541+
Include ``<native>`` frames for non-Python code.
1542+
1543+
.. option:: --no-gc
1544+
1545+
Exclude ``<GC>`` frames for active garbage collection.
1546+
1547+
.. option:: --opcodes
1548+
1549+
Show bytecode opcode names when available.
1550+
1551+
.. option:: --async-aware
1552+
1553+
Reconstruct the stack across ``await`` boundaries for asyncio
1554+
applications.
1555+
1556+
.. option:: --async-mode <mode>
1557+
1558+
Async stack mode: ``running`` (only the running task) or ``all``
1559+
(all tasks including waiting). Defaults to ``all`` for ``dump``.
1560+
Requires :option:`--async-aware`.
1561+
1562+
.. option:: --blocking
1563+
1564+
Pause all threads in the target process while reading the stack.
1565+
1566+
14491567
Sampling options
14501568
----------------
14511569

0 commit comments

Comments
 (0)