Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4b6cc35

Browse files
Merge branch 'main' into isolate-itertools/batch-3
2 parents a02e90a + 7990324 commit 4b6cc35

101 files changed

Lines changed: 7062 additions & 4511 deletions

File tree

Some content is hidden

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

Doc/bugs.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ If you find a bug in this documentation or would like to propose an improvement,
1919
please submit a bug report on the :ref:`tracker <using-the-tracker>`. If you
2020
have a suggestion on how to fix it, include that as well.
2121

22+
You can also open a discussion item on our
23+
`Documentation Discourse forum <https://discuss.python.org/c/documentation/26>`_.
24+
2225
If you're short on time, you can also email documentation bug reports to
2326
[email protected] (behavioral bugs can be sent to [email protected]).
2427
'docs@' is a mailing list run by volunteers; your request will be noticed,

Doc/c-api/code.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ bound into a function.
7777
7878
Returns ``1`` if the function succeeds and 0 otherwise.
7979
80+
.. versionadded:: 3.11
81+
8082
.. c:function:: PyObject* PyCode_GetCode(PyCodeObject *co)
8183
8284
Equivalent to the Python code ``getattr(co, 'co_code')``.

Doc/library/argparse.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Core Functionality
3131

3232
The :mod:`argparse` module's support for command-line interfaces is built
3333
around an instance of :class:`argparse.ArgumentParser`. It is a container for
34-
argument specifications and has options that apply the parser as whole::
34+
argument specifications and has options that apply to the parser as whole::
3535

3636
parser = argparse.ArgumentParser(
3737
prog = 'ProgramName',

Doc/library/asyncio-eventloop.rst

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -186,19 +186,24 @@ Running and stopping the loop
186186
.. coroutinemethod:: loop.shutdown_default_executor(timeout=None)
187187

188188
Schedule the closure of the default executor and wait for it to join all of
189-
the threads in the :class:`ThreadPoolExecutor`. After calling this method, a
190-
:exc:`RuntimeError` will be raised if :meth:`loop.run_in_executor` is called
191-
while using the default executor.
189+
the threads in the :class:`~concurrent.futures.ThreadPoolExecutor`.
190+
Once this method has been called,
191+
using the default executor with :meth:`loop.run_in_executor`
192+
will raise a :exc:`RuntimeError`.
192193

193-
The *timeout* parameter specifies the amount of time the executor will
194-
be given to finish joining. The default value is ``None``, which means the
195-
executor will be given an unlimited amount of time.
194+
The *timeout* parameter specifies the amount of time
195+
(in :class:`float` seconds) the executor will be given to finish joining.
196+
With the default, ``None``,
197+
the executor is allowed an unlimited amount of time.
196198

197-
If the timeout duration is reached, a warning is emitted and executor is
198-
terminated without waiting for its threads to finish joining.
199+
If the *timeout* is reached, a :exc:`RuntimeWarning` is emitted
200+
and the default executor is terminated
201+
without waiting for its threads to finish joining.
199202

200-
Note that there is no need to call this function when
201-
:func:`asyncio.run` is used.
203+
.. note::
204+
205+
Do not call this method when using :func:`asyncio.run`,
206+
as the latter handles default executor shutdown automatically.
202207

203208
.. versionadded:: 3.9
204209

@@ -213,22 +218,23 @@ Scheduling callbacks
213218
Schedule the *callback* :term:`callback` to be called with
214219
*args* arguments at the next iteration of the event loop.
215220

221+
Return an instance of :class:`asyncio.Handle`,
222+
which can be used later to cancel the callback.
223+
216224
Callbacks are called in the order in which they are registered.
217225
Each callback will be called exactly once.
218226

219-
An optional keyword-only *context* argument allows specifying a
227+
The optional keyword-only *context* argument specifies a
220228
custom :class:`contextvars.Context` for the *callback* to run in.
221-
The current context is used when no *context* is provided.
222-
223-
An instance of :class:`asyncio.Handle` is returned, which can be
224-
used later to cancel the callback.
229+
Callbacks use the current context when no *context* is provided.
225230

226-
This method is not thread-safe.
231+
Unlike :meth:`call_soon_threadsafe`, this method is not thread-safe.
227232

228233
.. method:: loop.call_soon_threadsafe(callback, *args, context=None)
229234

230-
A thread-safe variant of :meth:`call_soon`. Must be used to
231-
schedule callbacks *from another thread*.
235+
A thread-safe variant of :meth:`call_soon`. When scheduling callbacks from
236+
another thread, this function *must* be used, since :meth:`call_soon` is not
237+
thread-safe.
232238

233239
Raises :exc:`RuntimeError` if called on a loop that's been closed.
234240
This can happen on a secondary thread when the main application is

Doc/library/cmath.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Power and logarithmic functions
8989
logarithms.
9090

9191

92-
.. function:: log(x, base=None)
92+
.. function:: log(x[, base])
9393

9494
Returns the logarithm of *x* to the given *base*. If the *base* is not
9595
specified, returns the natural logarithm of *x*. There is one branch cut, from 0

Doc/library/concurrent.futures.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -281,18 +281,18 @@ to a :class:`ProcessPoolExecutor` will result in deadlock.
281281

282282
Added the *initializer* and *initargs* arguments.
283283

284+
.. note::
285+
The default :mod:`multiprocessing` start method
286+
(see :ref:`multiprocessing-start-methods`) will change away from
287+
*fork* in Python 3.14. Code that requires *fork* be used for their
288+
:class:`ProcessPoolExecutor` should explicitly specify that by
289+
passing a ``mp_context=multiprocessing.get_context("fork")``
290+
parameter.
291+
284292
.. versionchanged:: 3.11
285293
The *max_tasks_per_child* argument was added to allow users to
286294
control the lifetime of workers in the pool.
287295

288-
.. versionchanged:: 3.12
289-
The implicit use of the :mod:`multiprocessing` *fork* start method as a
290-
platform default (see :ref:`multiprocessing-start-methods`) now raises a
291-
:exc:`DeprecationWarning`. The default will change in Python 3.14.
292-
Code that requires *fork* should explicitly specify that when creating
293-
their :class:`ProcessPoolExecutor` by passing a
294-
``mp_context=multiprocessing.get_context('fork')`` parameter.
295-
296296
.. _processpoolexecutor-example:
297297

298298
ProcessPoolExecutor Example

Doc/library/ctypes.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,6 +1380,10 @@ way is to instantiate one of the following classes:
13801380
DLLs and determine which one is not found using Windows debugging and
13811381
tracing tools.
13821382

1383+
.. versionchanged:: 3.12
1384+
1385+
The *name* parameter can now be a :term:`path-like object`.
1386+
13831387
.. seealso::
13841388

13851389
`Microsoft DUMPBIN tool <https://docs.microsoft.com/cpp/build/reference/dependents>`_
@@ -1398,13 +1402,21 @@ way is to instantiate one of the following classes:
13981402
.. versionchanged:: 3.3
13991403
:exc:`WindowsError` used to be raised.
14001404

1405+
.. versionchanged:: 3.12
1406+
1407+
The *name* parameter can now be a :term:`path-like object`.
1408+
14011409

14021410
.. class:: WinDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=None)
14031411

14041412
Windows only: Instances of this class represent loaded shared libraries,
14051413
functions in these libraries use the ``stdcall`` calling convention, and are
14061414
assumed to return :c:expr:`int` by default.
14071415

1416+
.. versionchanged:: 3.12
1417+
1418+
The *name* parameter can now be a :term:`path-like object`.
1419+
14081420
The Python :term:`global interpreter lock` is released before calling any
14091421
function exported by these libraries, and reacquired afterwards.
14101422

@@ -1418,6 +1430,10 @@ function exported by these libraries, and reacquired afterwards.
14181430

14191431
Thus, this is only useful to call Python C api functions directly.
14201432

1433+
.. versionchanged:: 3.12
1434+
1435+
The *name* parameter can now be a :term:`path-like object`.
1436+
14211437
All these classes can be instantiated by calling them with at least one
14221438
argument, the pathname of the shared library. If you have an existing handle to
14231439
an already loaded shared library, it can be passed as the ``handle`` named
@@ -2510,6 +2526,7 @@ fields, or any other data types containing pointer type fields.
25102526
An optional small integer that allows overriding the alignment of
25112527
structure fields in the instance. :attr:`_pack_` must already be defined
25122528
when :attr:`_fields_` is assigned, otherwise it will have no effect.
2529+
Setting this attribute to 0 is the same as not setting it at all.
25132530

25142531

25152532
.. attribute:: _anonymous_

Doc/library/faulthandler.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ Python is deadlocked.
4343
The :ref:`Python Development Mode <devmode>` calls :func:`faulthandler.enable`
4444
at Python startup.
4545

46+
.. seealso::
47+
48+
Module :mod:`pdb`
49+
Interactive source code debugger for Python programs.
50+
51+
Module :mod:`traceback`
52+
Standard interface to extract, format and print stack traces of Python programs.
4653

4754
Dumping the traceback
4855
---------------------
@@ -52,6 +59,8 @@ Dumping the traceback
5259
Dump the tracebacks of all threads into *file*. If *all_threads* is
5360
``False``, dump only the current thread.
5461

62+
.. seealso:: :func:`traceback.print_tb`, which can be used to print a traceback object.
63+
5564
.. versionchanged:: 3.5
5665
Added support for passing file descriptor to this function.
5766

@@ -178,4 +187,3 @@ handler:
178187
File "/home/python/cpython/Lib/ctypes/__init__.py", line 486 in string_at
179188
File "<stdin>", line 1 in <module>
180189
Segmentation fault
181-

Doc/library/math.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,13 @@ Power and logarithmic functions
393393
.. versionadded:: 3.2
394394

395395

396-
.. function:: log(x, base=None)
396+
.. function:: log(x[, base])
397397

398-
Return the logarithm of *x* to the given *base*.
398+
With one argument, return the natural logarithm of *x* (to base *e*).
399+
400+
With two arguments, return the logarithm of *x* to the given *base*,
401+
calculated as ``log(x)/log(base)``.
399402

400-
If the *base* is not specified, returns the natural
401-
logarithm (base *e*) of *x*.
402403

403404
.. function:: log1p(x)
404405

Doc/library/multiprocessing.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ to start a process. These *start methods* are
126126

127127
Available on POSIX systems. Currently the default on POSIX except macOS.
128128

129+
.. note::
130+
The default start method will change away from *fork* in Python 3.14.
131+
Code that requires *fork* should explicitly specify that via
132+
:func:`get_context` or :func:`set_start_method`.
133+
129134
*forkserver*
130135
When the program starts and selects the *forkserver* start method,
131136
a server process is spawned. From then on, whenever a new process
@@ -138,11 +143,6 @@ to start a process. These *start methods* are
138143
Available on POSIX platforms which support passing file descriptors
139144
over Unix pipes such as Linux.
140145

141-
.. versionchanged:: 3.12
142-
Implicit use of the *fork* start method as the default now raises a
143-
:exc:`DeprecationWarning`. Code that requires it should explicitly
144-
specify *fork* via :func:`get_context` or :func:`set_start_method`.
145-
The default will change away from *fork* in 3.14.
146146

147147
.. versionchanged:: 3.8
148148

@@ -1107,6 +1107,7 @@ Miscellaneous
11071107
launched (before creating a :class:`Pool` or starting a :class:`Process`).
11081108

11091109
Only meaningful when using the ``'forkserver'`` start method.
1110+
See :ref:`multiprocessing-start-methods`.
11101111

11111112
.. versionadded:: 3.4
11121113

0 commit comments

Comments
 (0)