Skip to content

Commit 684ed04

Browse files
Merge pull request #1 from python/main
docs.github.com>desktop
2 parents e6c0888 + b3be16d commit 684ed04

46 files changed

Lines changed: 722 additions & 214 deletions

Some content is hidden

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

Doc/c-api/exceptions.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,21 @@ Printing and clearing
119119
.. versionadded:: 3.12
120120
121121
122+
.. c:function:: void PyErr_Display(PyObject *unused, PyObject *value, PyObject *tb)
123+
124+
Legacy variant of :c:func:`PyErr_DisplayException`.
125+
126+
Print the exception *value* with its traceback to :data:`sys.stderr`.
127+
If *value* has no traceback set, *tb* is used as its traceback.
128+
The first argument is ignored.
129+
130+
If :data:`sys.stderr` is ``None``, nothing is printed.
131+
If :data:`sys.stderr` is not set, the exception is dumped to the
132+
C ``stderr`` stream instead.
133+
134+
.. deprecated:: 3.12
135+
Use :c:func:`PyErr_DisplayException` instead.
136+
122137
Raising exceptions
123138
==================
124139

Doc/c-api/init_config.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,9 +1235,9 @@ PyConfig
12351235
12361236
.. c:member:: wchar_t* base_executable
12371237
1238-
Python base executable: :data:`sys._base_executable`.
1238+
Python base executable: ``sys._base_executable``.
12391239
1240-
Set by the :envvar:`__PYVENV_LAUNCHER__` environment variable.
1240+
Set by the ``__PYVENV_LAUNCHER__`` environment variable.
12411241
12421242
Set from :c:member:`PyConfig.executable` if ``NULL``.
12431243
@@ -1748,7 +1748,7 @@ PyConfig
17481748
17491749
* On macOS, use :envvar:`PYTHONEXECUTABLE` environment variable if set.
17501750
* If the ``WITH_NEXT_FRAMEWORK`` macro is defined, use
1751-
:envvar:`__PYVENV_LAUNCHER__` environment variable if set.
1751+
``__PYVENV_LAUNCHER__`` environment variable if set.
17521752
* Use ``argv[0]`` of :c:member:`~PyConfig.argv` if available and
17531753
non-empty.
17541754
* Otherwise, use ``L"python"`` on Windows, or ``L"python3"`` on other
@@ -1984,8 +1984,7 @@ PyConfig
19841984
19851985
The :mod:`warnings` module adds :data:`sys.warnoptions` in the reverse
19861986
order: the last :c:member:`PyConfig.warnoptions` item becomes the first
1987-
item of :data:`warnings.filters` which is checked first (highest
1988-
priority).
1987+
item of ``warnings.filters`` which is checked first (highest priority).
19891988
19901989
The :option:`-W` command line options adds its value to
19911990
:c:member:`~PyConfig.warnoptions`, it can be used multiple times.

Doc/c-api/intro.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ when defined by the compiler, will also implicitly enable :c:macro:`!Py_DEBUG`.
11631163
In addition to the reference count debugging described below, extra checks are
11641164
performed. See :ref:`Python Debug Build <debug-build>` for more details.
11651165

1166-
Defining :c:macro:`Py_TRACE_REFS` enables reference tracing
1166+
Defining ``Py_TRACE_REFS`` enables reference tracing
11671167
(see the :option:`configure --with-trace-refs option <--with-trace-refs>`).
11681168
When defined, a circular doubly linked list of active objects is maintained by adding two extra
11691169
fields to every :c:type:`PyObject`. Total allocations are tracked as well. Upon

Doc/library/asyncio-task.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,10 @@ unless it is :exc:`asyncio.CancelledError`,
433433
is also included in the exception group.
434434
The same special case is made for
435435
:exc:`KeyboardInterrupt` and :exc:`SystemExit` as in the previous paragraph.
436+
There is an additional special case made only for the body of the
437+
``async with``: if it raises :exc:`GeneratorExit` and none of the
438+
other tasks raise exceptions that would be reported, then the
439+
:exc:`GeneratorExit` is reraised.
436440

437441
Task groups are careful not to mix up the internal cancellation used to
438442
"wake up" their :meth:`~object.__aexit__` with cancellation requests
@@ -456,6 +460,10 @@ reported by :meth:`asyncio.Task.cancelling`.
456460
Improved handling of simultaneous internal and external cancellations
457461
and correct preservation of cancellation counts.
458462

463+
.. versionchanged:: 3.15
464+
465+
Addition of the special case for :exc:`GeneratorExit`.
466+
459467
Sleeping
460468
========
461469

Doc/library/multiprocessing.rst

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2536,7 +2536,7 @@ with the :class:`Pool` class.
25362536
Callbacks should complete immediately since otherwise the thread which
25372537
handles the results will get blocked.
25382538

2539-
.. method:: imap(func, iterable[, chunksize])
2539+
.. method:: imap(func, iterable, chunksize=1, *, buffersize=None)
25402540

25412541
A lazier version of :meth:`.map`.
25422542

@@ -2550,12 +2550,27 @@ with the :class:`Pool` class.
25502550
``next(timeout)`` will raise :exc:`multiprocessing.TimeoutError` if the
25512551
result cannot be returned within *timeout* seconds.
25522552

2553-
.. method:: imap_unordered(func, iterable[, chunksize])
2553+
The *iterable* is collected immediately rather than lazily, unless a
2554+
*buffersize* is specified to limit the number of submitted tasks whose
2555+
results have not yet been yielded. If the buffer is full, iteration over
2556+
the *iterables* pauses until a result is yielded from the buffer.
2557+
To fully utilize pool's capacity when using this feature,
2558+
set *buffersize* at least to the number of processes in pool
2559+
(to consume *iterable* as you go), or even higher
2560+
(to prefetch the next ``N=buffersize-processes`` arguments).
2561+
2562+
.. versionchanged:: next
2563+
Added the *buffersize* parameter.
2564+
2565+
.. method:: imap_unordered(func, iterable, chunksize=1, *, buffersize=None)
25542566

25552567
The same as :meth:`imap` except that the ordering of the results from the
25562568
returned iterator should be considered arbitrary. (Only when there is
25572569
only one worker process is the order guaranteed to be "correct".)
25582570

2571+
.. versionchanged:: next
2572+
Added the *buffersize* parameter.
2573+
25592574
.. method:: starmap(func, iterable[, chunksize])
25602575

25612576
Like :meth:`~multiprocessing.pool.Pool.map` except that the

Doc/library/os.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,9 +802,9 @@ process and user.
802802
Returns information identifying the current operating system.
803803
The return value is a :class:`uname_result`.
804804

805-
On macOS, iOS and Android, this returns the *kernel* name and version (i.e.,
805+
On macOS, iOS and Android, this returns the *kernel* name and release (i.e.,
806806
``'Darwin'`` on macOS and iOS; ``'Linux'`` on Android). :func:`platform.uname`
807-
can be used to get the user-facing operating system name and version on iOS and
807+
can be used to get the user-facing operating system name and release on iOS and
808808
Android.
809809

810810
.. seealso::

Doc/library/platform.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ Cross platform
141141
Returns the system's release, e.g. ``'2.2.0'`` or ``'NT'``. An empty string is
142142
returned if the value cannot be determined.
143143

144+
On iOS and Android, this is the user-facing OS release. To obtain the
145+
Darwin or Linux kernel release, use :func:`os.uname`.
144146

145147
.. function:: system()
146148

@@ -163,9 +165,6 @@ Cross platform
163165
Returns the system's release version, e.g. ``'#3 on degas'``. An empty string is
164166
returned if the value cannot be determined.
165167

166-
On iOS and Android, this is the user-facing OS version. To obtain the
167-
Darwin or Linux kernel version, use :func:`os.uname`.
168-
169168
.. function:: uname()
170169

171170
Fairly portable uname interface. Returns a :func:`~collections.namedtuple`

Doc/tools/.nitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
# as tested on the CI via check-warnings.py in reusable-docs.yml.
33
# Keep lines sorted lexicographically to help avoid merge conflicts.
44

5-
Doc/c-api/init_config.rst
6-
Doc/c-api/intro.rst
7-
Doc/c-api/stable.rst
85
Doc/library/ast.rst
96
Doc/library/asyncio-extending.rst
107
Doc/library/email.charset.rst

Doc/whatsnew/3.16.rst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,22 @@ math
376376
(Contributed by Jeff Epler in :gh:`150534`.)
377377

378378

379+
multiprocessing
380+
---------------
381+
382+
* Add the optional ``buffersize`` parameter to
383+
:meth:`multiprocessing.pool.Pool.imap` and
384+
:meth:`multiprocessing.pool.Pool.imap_unordered` to limit the number of
385+
submitted tasks whose results have not yet been yielded. If the buffer is
386+
full, iteration over the *iterables* pauses until a result is yielded from
387+
the buffer. To fully utilize pool's capacity when using this feature, set
388+
*buffersize* at least to the number of processes in pool (to consume
389+
*iterable* as you go), or even higher (to prefetch the next
390+
``N=buffersize-processes`` arguments).
391+
392+
(Contributed by Oleksandr Baltian in :gh:`136871`.)
393+
394+
379395
os
380396
--
381397

@@ -606,7 +622,7 @@ module_name
606622

607623

608624
Removed
609-
=======
625+
========
610626

611627
annotationlib
612628
-------------

Include/internal/pycore_opcode_metadata.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)