Skip to content

Commit dc1d3fc

Browse files
committed
Merge branch 'main' into gh-101178-rework-base85
2 parents bc9a66d + 0efbad6 commit dc1d3fc

File tree

74 files changed

+1821
-1077
lines changed

Some content is hidden

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

74 files changed

+1821
-1077
lines changed

Doc/c-api/module.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ A module's token -- and the *your_token* value to use in the above code -- is:
571571
of that slot;
572572
- For modules created from an ``PyModExport_*``
573573
:ref:`export hook <extension-export-hook>`: the slots array that the export
574-
hook returned (unless overriden with :c:macro:`Py_mod_token`).
574+
hook returned (unless overridden with :c:macro:`Py_mod_token`).
575575
576576
.. c:macro:: Py_mod_token
577577

Doc/library/inspect.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
273273
+-----------------+-------------------+---------------------------+
274274
| | ag_running | is the generator running? |
275275
+-----------------+-------------------+---------------------------+
276+
| | ag_suspended | is the generator |
277+
| | | suspended? |
278+
+-----------------+-------------------+---------------------------+
276279
| | ag_code | code |
277280
+-----------------+-------------------+---------------------------+
278281
| coroutine | __name__ | name |
@@ -286,6 +289,9 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
286289
+-----------------+-------------------+---------------------------+
287290
| | cr_running | is the coroutine running? |
288291
+-----------------+-------------------+---------------------------+
292+
| | cr_suspended | is the coroutine |
293+
| | | suspended? |
294+
+-----------------+-------------------+---------------------------+
289295
| | cr_code | code |
290296
+-----------------+-------------------+---------------------------+
291297
| | cr_origin | where coroutine was |
@@ -319,6 +325,18 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
319325

320326
Add ``__builtins__`` attribute to functions.
321327

328+
.. versionchanged:: 3.11
329+
330+
Add ``gi_suspended`` attribute to generators.
331+
332+
.. versionchanged:: 3.11
333+
334+
Add ``cr_suspended`` attribute to coroutines.
335+
336+
.. versionchanged:: 3.12
337+
338+
Add ``ag_suspended`` attribute to async generators.
339+
322340
.. versionchanged:: 3.14
323341

324342
Add ``f_generator`` attribute to frames.

Doc/library/linecache.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The :mod:`linecache` module defines the following functions:
3131
.. index:: triple: module; search; path
3232

3333
If *filename* indicates a frozen module (starting with ``'<frozen '``), the function
34-
will attepmt to get the real file name from ``module_globals['__file__']`` if
34+
will attempt to get the real file name from ``module_globals['__file__']`` if
3535
*module_globals* is not ``None``.
3636

3737
If a file named *filename* is not found, the function first checks

Doc/library/mmap.rst

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
212212
Writable :term:`bytes-like object` is now accepted.
213213

214214

215-
.. method:: flush([offset[, size]])
215+
.. method:: flush([offset[, size]], *, flags=MS_SYNC)
216216

217217
Flushes changes made to the in-memory copy of a file back to disk. Without
218218
use of this call there is no guarantee that changes are written back before
@@ -221,6 +221,12 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
221221
whole extent of the mapping is flushed. *offset* must be a multiple of the
222222
:const:`PAGESIZE` or :const:`ALLOCATIONGRANULARITY`.
223223

224+
The *flags* parameter specifies the synchronization behavior.
225+
*flags* must be one of the :ref:`MS_* constants <ms-constants>` available
226+
on the system.
227+
228+
On Windows, the *flags* parameter is ignored.
229+
224230
``None`` is returned to indicate success. An exception is raised when the
225231
call failed.
226232

@@ -235,6 +241,9 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
235241
specified alone, and the flush operation will extend from *offset*
236242
to the end of the mmap.
237243

244+
.. versionchanged:: next
245+
Added *flags* parameter to control synchronization behavior.
246+
238247

239248
.. method:: madvise(option[, start[, length]])
240249

@@ -461,3 +470,22 @@ MAP_* Constants
461470
:data:`MAP_TPRO`, :data:`MAP_TRANSLATED_ALLOW_EXECUTE`, and
462471
:data:`MAP_UNIX03` constants.
463472

473+
.. _ms-constants:
474+
475+
MS_* Constants
476+
++++++++++++++
477+
478+
.. data:: MS_SYNC
479+
MS_ASYNC
480+
MS_INVALIDATE
481+
482+
These flags control the synchronization behavior for :meth:`mmap.flush`:
483+
484+
* :data:`MS_SYNC` - Synchronous flush: writes are scheduled and the call
485+
blocks until they are physically written to storage.
486+
* :data:`MS_ASYNC` - Asynchronous flush: writes are scheduled but the call
487+
returns immediately without waiting for completion.
488+
* :data:`MS_INVALIDATE` - Invalidate cached data: invalidates other mappings
489+
of the same file so they can see the changes.
490+
491+
.. versionadded:: next

Doc/library/os.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5993,7 +5993,7 @@ Miscellaneous System Information
59935993

59945994
.. versionchanged:: 3.13
59955995
If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is set,
5996-
:func:`cpu_count` returns the overridden value *n*.
5996+
:func:`cpu_count` returns the override value *n*.
59975997

59985998

59995999
.. function:: getloadavg()
@@ -6015,7 +6015,7 @@ Miscellaneous System Information
60156015
in the **system**.
60166016

60176017
If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is set,
6018-
:func:`process_cpu_count` returns the overridden value *n*.
6018+
:func:`process_cpu_count` returns the override value *n*.
60196019

60206020
See also the :func:`sched_getaffinity` function.
60216021

Doc/library/profiling.sampling.rst

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ is unaware it is being profiled.
241241
When profiling production systems, keep these guidelines in mind:
242242

243243
Start with shorter durations (10-30 seconds) to get quick results, then extend
244-
if you need more statistical accuracy. The default 10-second duration is usually
245-
sufficient to identify major hotspots.
244+
if you need more statistical accuracy. By default, profiling runs until the
245+
target process completes, which is usually sufficient to identify major hotspots.
246246

247247
If possible, profile during representative load rather than peak traffic.
248248
Profiles collected during normal operation are easier to interpret than those
@@ -329,7 +329,7 @@ The default configuration works well for most use cases:
329329
* - Default for ``--sampling-rate`` / ``-r``
330330
- 1 kHz
331331
* - Default for ``--duration`` / ``-d``
332-
- 10 seconds
332+
- Run to completion
333333
* - Default for ``--all-threads`` / ``-a``
334334
- Main thread only
335335
* - Default for ``--native``
@@ -363,15 +363,14 @@ cost of slightly higher profiler CPU usage. Lower rates reduce profiler
363363
overhead but may miss short-lived functions. For most applications, the
364364
default rate provides a good balance between accuracy and overhead.
365365

366-
The :option:`--duration` option (:option:`-d`) sets how long to profile in seconds. The
367-
default is 10 seconds::
366+
The :option:`--duration` option (:option:`-d`) sets how long to profile in seconds. By
367+
default, profiling continues until the target process exits or is interrupted::
368368

369369
python -m profiling.sampling run -d 60 script.py
370370

371-
Longer durations collect more samples and produce more statistically reliable
372-
results, especially for code paths that execute infrequently. When profiling
373-
a program that runs for a fixed time, you may want to set the duration to
374-
match or exceed the expected runtime.
371+
Specifying a duration is useful when attaching to long-running processes or when
372+
you want to limit profiling to a specific time window. When profiling a script,
373+
the default behavior of running to completion is usually what you want.
375374

376375

377376
Thread selection
@@ -1394,7 +1393,7 @@ Sampling options
13941393

13951394
.. option:: -d <seconds>, --duration <seconds>
13961395

1397-
Profiling duration in seconds. Default: 10.
1396+
Profiling duration in seconds. Default: run to completion.
13981397

13991398
.. option:: -a, --all-threads
14001399

Doc/library/zoneinfo.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ The ``ZoneInfo`` class has two alternate constructors:
206206

207207
Objects created via this constructor cannot be pickled (see `pickling`_).
208208

209+
:exc:`ValueError` is raised if the data read from *file_obj* is not a valid
210+
TZif file.
211+
209212
.. classmethod:: ZoneInfo.no_cache(key)
210213

211214
An alternate constructor that bypasses the constructor's cache. It is

Doc/tools/extensions/grammar_snippet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ class GrammarSnippetDirective(GrammarSnippetBase):
191191
into something similar to Sphinx productionlist, but better suited
192192
for our needs:
193193
- Instead of `::=`, use a colon, as in `Grammar/python.gram`
194-
- Show the listing almost as is, with no auto-aligment.
194+
- Show the listing almost as is, with no auto-alignment.
195195
The only special character is the backtick, which marks tokens.
196196
197197
Unlike Sphinx's productionlist, this directive supports options.

Doc/whatsnew/3.15.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -854,11 +854,13 @@ Optimizations
854854

855855
* Builds using Visual Studio 2026 (MSVC 18) may now use the new
856856
:ref:`tail-calling interpreter <whatsnew314-tail-call-interpreter>`.
857-
Results on an early experimental MSVC compiler reported roughly 15% speedup
858-
on the geometric mean of pyperformance on Windows x86-64 over
859-
the switch-case interpreter. We have
860-
observed speedups ranging from 15% for large pure-Python libraries
857+
Results on Visual Studio 18.1.1 report between
858+
`15-20% <https://github.com/faster-cpython/ideas/blob/main/results/5800X-msvc.pgo2-vs-msvc.pgo.tc.svg>`__
859+
speedup on the geometric mean of pyperformance on Windows x86-64 over
860+
the switch-case interpreter on an AMD Ryzen 7 5800X. We have
861+
observed speedups ranging from 14% for large pure-Python libraries
861862
to 40% for long-running small pure-Python scripts on Windows.
863+
This was made possible by a new feature introduced in MSVC 18.
862864
(Contributed by Chris Eibl, Ken Jin, and Brandt Bucher in :gh:`143068`.
863865
Special thanks to the MSVC team including Hulon Jenkins.)
864866

Include/internal/pycore_ceval.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ extern int _PyPerfTrampoline_SetCallbacks(_PyPerf_Callbacks *);
103103
extern void _PyPerfTrampoline_GetCallbacks(_PyPerf_Callbacks *);
104104
extern int _PyPerfTrampoline_Init(int activate);
105105
extern int _PyPerfTrampoline_Fini(void);
106-
extern void _PyPerfTrampoline_FreeArenas(void);
107106
extern int _PyIsPerfTrampolineActive(void);
108107
extern PyStatus _PyPerfTrampoline_AfterFork_Child(void);
109108
#ifdef PY_HAVE_PERF_TRAMPOLINE

0 commit comments

Comments
 (0)