Skip to content

Commit d1770d9

Browse files
committed
Deploy preview for PR 1123 🛫
1 parent c54e78c commit d1770d9

File tree

559 files changed

+5843
-5658
lines changed

Some content is hidden

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

559 files changed

+5843
-5658
lines changed

pr-preview/pr-1123/_sources/library/asyncio-eventloop.rst.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,12 @@ Opening network connections
595595
to bind the socket locally. The *local_host* and *local_port*
596596
are looked up using :meth:`getaddrinfo`.
597597

598+
.. note::
599+
600+
On Windows, when using the proactor event loop with ``local_addr=None``,
601+
an :exc:`OSError` with :attr:`!errno.WSAEINVAL` will be raised
602+
when running it.
603+
598604
* *remote_addr*, if given, is a ``(remote_host, remote_port)`` tuple used
599605
to connect the socket to a remote address. The *remote_host* and
600606
*remote_port* are looked up using :meth:`getaddrinfo`.

pr-preview/pr-1123/_sources/library/codecs.rst.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,6 +1472,36 @@ to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode`
14721472
Restoration of the aliases for the binary transforms.
14731473

14741474

1475+
.. _standalone-codec-functions:
1476+
1477+
Standalone Codec Functions
1478+
^^^^^^^^^^^^^^^^^^^^^^^^^^
1479+
1480+
The following functions provide encoding and decoding functionality similar to codecs,
1481+
but are not available as named codecs through :func:`codecs.encode` or :func:`codecs.decode`.
1482+
They are used internally (for example, by :mod:`pickle`) and behave similarly to the
1483+
``string_escape`` codec that was removed in Python 3.
1484+
1485+
.. function:: codecs.escape_encode(input, errors=None)
1486+
1487+
Encode *input* using escape sequences. Similar to how :func:`repr` on bytes
1488+
produces escaped byte values.
1489+
1490+
*input* must be a :class:`bytes` object.
1491+
1492+
Returns a tuple ``(output, length)`` where *output* is a :class:`bytes`
1493+
object and *length* is the number of bytes consumed.
1494+
1495+
.. function:: codecs.escape_decode(input, errors=None)
1496+
1497+
Decode *input* from escape sequences back to the original bytes.
1498+
1499+
*input* must be a :term:`bytes-like object`.
1500+
1501+
Returns a tuple ``(output, length)`` where *output* is a :class:`bytes`
1502+
object and *length* is the number of bytes consumed.
1503+
1504+
14751505
.. _text-transforms:
14761506

14771507
Text Transforms

pr-preview/pr-1123/_sources/library/concurrent.futures.rst.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,11 @@ that :class:`ProcessPoolExecutor` will not work in the interactive interpreter.
243243
Calling :class:`Executor` or :class:`Future` methods from a callable submitted
244244
to a :class:`ProcessPoolExecutor` will result in deadlock.
245245

246+
Note that the restrictions on functions and arguments needing to picklable as
247+
per :class:`multiprocessing.Process` apply when using :meth:`~Executor.submit`
248+
and :meth:`~Executor.map` on a :class:`ProcessPoolExecutor`. A function defined
249+
in a REPL or a lambda should not be expected to work.
250+
246251
.. class:: ProcessPoolExecutor(max_workers=None, mp_context=None, initializer=None, initargs=(), max_tasks_per_child=None)
247252

248253
An :class:`Executor` subclass that executes calls asynchronously using a pool

pr-preview/pr-1123/_sources/library/http.cookies.rst.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,12 @@ Morsel Objects
147147
in HTTP requests, and is not accessible through JavaScript. This is intended
148148
to mitigate some forms of cross-site scripting.
149149

150-
The attribute :attr:`samesite` specifies that the browser is not allowed to
151-
send the cookie along with cross-site requests. This helps to mitigate CSRF
152-
attacks. Valid values for this attribute are "Strict" and "Lax".
150+
The attribute :attr:`samesite` controls when the browser sends the cookie with
151+
cross-site requests. This helps to mitigate CSRF attacks. Valid values are
152+
"Strict" (only sent with same-site requests), "Lax" (sent with same-site
153+
requests and top-level navigations), and "None" (sent with same-site and
154+
cross-site requests). When using "None", the "secure" attribute must also
155+
be set, as required by modern browsers.
153156

154157
The keys are case-insensitive and their default value is ``''``.
155158

pr-preview/pr-1123/_sources/library/multiprocessing.rst.txt

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ To show the individual process IDs involved, here is an expanded example::
9797
For an explanation of why the ``if __name__ == '__main__'`` part is
9898
necessary, see :ref:`multiprocessing-programming`.
9999

100+
The arguments to :class:`Process` usually need to be unpickleable from within
101+
the child process. If you tried typing the above example directly into a REPL it
102+
could lead to an :exc:`AttributeError` in the child process trying to locate the
103+
*f* function in the ``__main__`` module.
100104

101105

102106
.. _multiprocessing-start-methods:
@@ -107,6 +111,8 @@ Contexts and start methods
107111
Depending on the platform, :mod:`multiprocessing` supports three ways
108112
to start a process. These *start methods* are
109113

114+
.. _multiprocessing-start-method-spawn:
115+
110116
*spawn*
111117
The parent process starts a fresh Python interpreter process. The
112118
child process will only inherit those resources necessary to run
@@ -117,6 +123,8 @@ to start a process. These *start methods* are
117123

118124
Available on POSIX and Windows platforms. The default on Windows and macOS.
119125

126+
.. _multiprocessing-start-method-fork:
127+
120128
*fork*
121129
The parent process uses :func:`os.fork` to fork the Python
122130
interpreter. The child process, when it begins, is effectively
@@ -137,6 +145,8 @@ to start a process. These *start methods* are
137145
raise a :exc:`DeprecationWarning`. Use a different start method.
138146
See the :func:`os.fork` documentation for further explanation.
139147

148+
.. _multiprocessing-start-method-forkserver:
149+
140150
*forkserver*
141151
When the program starts and selects the *forkserver* start method,
142152
a server process is spawned. From then on, whenever a new process
@@ -218,9 +228,12 @@ processes for a different context. In particular, locks created using
218228
the *fork* context cannot be passed to processes started using the
219229
*spawn* or *forkserver* start methods.
220230

221-
A library which wants to use a particular start method should probably
222-
use :func:`get_context` to avoid interfering with the choice of the
223-
library user.
231+
Libraries using :mod:`multiprocessing` or
232+
:class:`~concurrent.futures.ProcessPoolExecutor` should be designed to allow
233+
their users to provide their own multiprocessing context. Using a specific
234+
context of your own within a library can lead to incompatibilities with the
235+
rest of the library user's application. Always document if your library
236+
requires a specific start method.
224237

225238
.. warning::
226239

@@ -518,9 +531,42 @@ The :mod:`multiprocessing` package mostly replicates the API of the
518531
to pass to *target*.
519532

520533
If a subclass overrides the constructor, it must make sure it invokes the
521-
base class constructor (:meth:`Process.__init__`) before doing anything else
534+
base class constructor (``super().__init__()``) before doing anything else
522535
to the process.
523536

537+
.. note::
538+
539+
In general, all arguments to :class:`Process` must be picklable. This is
540+
frequently observed when trying to create a :class:`Process` or use a
541+
:class:`concurrent.futures.ProcessPoolExecutor` from a REPL with a
542+
locally defined *target* function.
543+
544+
Passing a callable object defined in the current REPL session causes the
545+
child process to die via an uncaught :exc:`AttributeError` exception when
546+
starting as *target* must have been defined within an importable module
547+
in order to be loaded during unpickling.
548+
549+
Example of this uncatchable error from the child::
550+
551+
>>> import multiprocessing as mp
552+
>>> def knigit():
553+
... print("Ni!")
554+
...
555+
>>> process = mp.Process(target=knigit)
556+
>>> process.start()
557+
>>> Traceback (most recent call last):
558+
File ".../multiprocessing/spawn.py", line ..., in spawn_main
559+
File ".../multiprocessing/spawn.py", line ..., in _main
560+
AttributeError: module '__main__' has no attribute 'knigit'
561+
>>> process
562+
<SpawnProcess name='SpawnProcess-1' pid=379473 parent=378707 stopped exitcode=1>
563+
564+
See :ref:`multiprocessing-programming-spawn`. While this restriction is
565+
not true if using the ``"fork"`` start method, as of Python ``3.14`` that
566+
is no longer the default on any platform. See
567+
:ref:`multiprocessing-start-methods`.
568+
See also :gh:`132898`.
569+
524570
.. versionchanged:: 3.3
525571
Added the *daemon* parameter.
526572

@@ -2985,6 +3031,9 @@ Beware of replacing :data:`sys.stdin` with a "file like object"
29853031

29863032
For more information, see :issue:`5155`, :issue:`5313` and :issue:`5331`
29873033

3034+
.. _multiprocessing-programming-spawn:
3035+
.. _multiprocessing-programming-forkserver:
3036+
29883037
The *spawn* and *forkserver* start methods
29893038
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
29903039

@@ -2993,10 +3042,10 @@ start method.
29933042

29943043
More picklability
29953044

2996-
Ensure that all arguments to :meth:`Process.__init__` are picklable.
2997-
Also, if you subclass :class:`~multiprocessing.Process` then make sure that
2998-
instances will be picklable when the :meth:`Process.start
2999-
<multiprocessing.Process.start>` method is called.
3045+
Ensure that all arguments to :class:`~multiprocessing.Process` are
3046+
picklable. Also, if you subclass ``Process.__init__``, you must make sure
3047+
that instances will be picklable when the
3048+
:meth:`Process.start <multiprocessing.Process.start>` method is called.
30003049

30013050
Global variables
30023051

pr-preview/pr-1123/about.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ <h3>此頁面</h3>
111111
<ul class="this-page-menu">
112112
<li><a href="bugs.html">回報錯誤</a></li>
113113
<li>
114-
<a href="https://github.com/python/cpython/blob/main/Doc/about.rst"
114+
<a href="https://github.com/python/cpython/blob/main/Doc/about.rst?plain=1"
115115
rel="nofollow">顯示原始碼
116116
</a>
117117
</li>
@@ -230,7 +230,7 @@ <h3>此頁面</h3>
230230
<ul class="this-page-menu">
231231
<li><a href="bugs.html">回報錯誤</a></li>
232232
<li>
233-
<a href="https://github.com/python/cpython/blob/main/Doc/about.rst"
233+
<a href="https://github.com/python/cpython/blob/main/Doc/about.rst?plain=1"
234234
rel="nofollow">顯示原始碼
235235
</a>
236236
</li>
@@ -320,7 +320,7 @@ <h3>瀏覽</h3>
320320
<a href="https://www.python.org/psf/donations/">Please donate.</a>
321321
<br>
322322
<br>
323-
最後更新於 7月 26, 2025 (00:22 UTC)。
323+
最後更新於 7月 28, 2025 (16:34 UTC)。
324324

325325
<a href="/bugs.html">Found a bug</a>?
326326

pr-preview/pr-1123/bugs.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ <h3>此頁面</h3>
113113
<ul class="this-page-menu">
114114
<li><a href="#">回報錯誤</a></li>
115115
<li>
116-
<a href="https://github.com/python/cpython/blob/main/Doc/bugs.rst"
116+
<a href="https://github.com/python/cpython/blob/main/Doc/bugs.rst?plain=1"
117117
rel="nofollow">顯示原始碼
118118
</a>
119119
</li>
@@ -231,7 +231,7 @@ <h2>說明文件的錯誤<a class="headerlink" href="#documentation-bugs" title=
231231
</section>
232232
<section id="getting-started-contributing-to-python-yourself">
233233
<span id="contributing-to-python"></span><h2>開始讓自己貢獻 Python<a class="headerlink" href="#getting-started-contributing-to-python-yourself" title="連結到這個標頭"></a></h2>
234-
<p>除了只是回報你所發現的錯誤之外,同樣也歡迎你提交修正它們的修補程式 (patch)。你可以在 <a class="reference external" href="https://mail.python.org/mailman3/lists/core-mentorship.python.org/">Python 開發者指南</a>中找到如何開始修補 Python 的更多資訊。如果你有任何問題,<a class="reference external" href="https://devguide.python.org/">核心導師郵寄清單</a>是一個友善的地方,你可以在那裡得到,關於 Python 修正錯誤的過程中,所有問題的答案。</p>
234+
<p>除了只是回報你所發現的錯誤之外,同樣也歡迎你提交修正它們的修補程式 (patch)。你可以在 <a class="reference external" href="https://devguide.python.org/">Python 開發者指南</a>中找到如何開始修補 Python 的更多資訊。如果你有任何問題,<a class="reference external" href="https://mail.python.org/mailman3/lists/core-mentorship.python.org/">核心導師郵寄清單</a>是一個友善的地方,你可以在那裡得到,關於 Python 修正錯誤的過程中,所有問題的答案。</p>
235235
</section>
236236
</section>
237237

@@ -269,7 +269,7 @@ <h3>此頁面</h3>
269269
<ul class="this-page-menu">
270270
<li><a href="#">回報錯誤</a></li>
271271
<li>
272-
<a href="https://github.com/python/cpython/blob/main/Doc/bugs.rst"
272+
<a href="https://github.com/python/cpython/blob/main/Doc/bugs.rst?plain=1"
273273
rel="nofollow">顯示原始碼
274274
</a>
275275
</li>
@@ -359,7 +359,7 @@ <h3>瀏覽</h3>
359359
<a href="https://www.python.org/psf/donations/">Please donate.</a>
360360
<br>
361361
<br>
362-
最後更新於 7月 26, 2025 (00:22 UTC)。
362+
最後更新於 7月 28, 2025 (16:34 UTC)。
363363

364364
<a href="/bugs.html">Found a bug</a>?
365365

pr-preview/pr-1123/c-api/abstract.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ <h3>此頁面</h3>
101101
<ul class="this-page-menu">
102102
<li><a href="../bugs.html">回報錯誤</a></li>
103103
<li>
104-
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/abstract.rst"
104+
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/abstract.rst?plain=1"
105105
rel="nofollow">顯示原始碼
106106
</a>
107107
</li>
@@ -238,7 +238,7 @@ <h3>此頁面</h3>
238238
<ul class="this-page-menu">
239239
<li><a href="../bugs.html">回報錯誤</a></li>
240240
<li>
241-
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/abstract.rst"
241+
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/abstract.rst?plain=1"
242242
rel="nofollow">顯示原始碼
243243
</a>
244244
</li>
@@ -329,7 +329,7 @@ <h3>瀏覽</h3>
329329
<a href="https://www.python.org/psf/donations/">Please donate.</a>
330330
<br>
331331
<br>
332-
最後更新於 7月 26, 2025 (00:22 UTC)。
332+
最後更新於 7月 28, 2025 (16:34 UTC)。
333333

334334
<a href="/bugs.html">Found a bug</a>?
335335

pr-preview/pr-1123/c-api/allocation.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ <h3>此頁面</h3>
101101
<ul class="this-page-menu">
102102
<li><a href="../bugs.html">回報錯誤</a></li>
103103
<li>
104-
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/allocation.rst"
104+
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/allocation.rst?plain=1"
105105
rel="nofollow">顯示原始碼
106106
</a>
107107
</li>
@@ -254,7 +254,7 @@ <h3>此頁面</h3>
254254
<ul class="this-page-menu">
255255
<li><a href="../bugs.html">回報錯誤</a></li>
256256
<li>
257-
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/allocation.rst"
257+
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/allocation.rst?plain=1"
258258
rel="nofollow">顯示原始碼
259259
</a>
260260
</li>
@@ -346,7 +346,7 @@ <h3>瀏覽</h3>
346346
<a href="https://www.python.org/psf/donations/">Please donate.</a>
347347
<br>
348348
<br>
349-
最後更新於 7月 26, 2025 (00:22 UTC)。
349+
最後更新於 7月 28, 2025 (16:34 UTC)。
350350

351351
<a href="/bugs.html">Found a bug</a>?
352352

pr-preview/pr-1123/c-api/apiabiversion.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ <h3>此頁面</h3>
101101
<ul class="this-page-menu">
102102
<li><a href="../bugs.html">回報錯誤</a></li>
103103
<li>
104-
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/apiabiversion.rst"
104+
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/apiabiversion.rst?plain=1"
105105
rel="nofollow">顯示原始碼
106106
</a>
107107
</li>
@@ -285,7 +285,7 @@ <h3>此頁面</h3>
285285
<ul class="this-page-menu">
286286
<li><a href="../bugs.html">回報錯誤</a></li>
287287
<li>
288-
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/apiabiversion.rst"
288+
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/apiabiversion.rst?plain=1"
289289
rel="nofollow">顯示原始碼
290290
</a>
291291
</li>
@@ -376,7 +376,7 @@ <h3>瀏覽</h3>
376376
<a href="https://www.python.org/psf/donations/">Please donate.</a>
377377
<br>
378378
<br>
379-
最後更新於 7月 26, 2025 (00:22 UTC)。
379+
最後更新於 7月 28, 2025 (16:34 UTC)。
380380

381381
<a href="/bugs.html">Found a bug</a>?
382382

0 commit comments

Comments
 (0)