Skip to content

Commit 20b945c

Browse files
authored
Merge branch 'main' into main
2 parents 7aae839 + f5e11fa commit 20b945c

Some content is hidden

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

51 files changed

+1575
-1040
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/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/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.

Include/internal/pycore_opcode_metadata.h

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)