Skip to content

Commit e3b4e7f

Browse files
Deploy preview for PR 1231 🛫
1 parent 9fb6946 commit e3b4e7f

586 files changed

Lines changed: 637 additions & 605 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.

pr-preview/pr-1231/_sources/c-api/arg.rst.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,18 @@ inside nested parentheses. They are:
392392
their default value --- when an optional argument is not specified,
393393
:c:func:`PyArg_ParseTuple` does not touch the contents of the corresponding C
394394
variable(s).
395+
For example, the format string ``"OO|OO"`` corresponds to the Python
396+
signature ``f(a, b, c=None, d=None)``.
395397

396398
``$``
397399
:c:func:`PyArg_ParseTupleAndKeywords` only:
398400
Indicates that the remaining arguments in the Python argument list are
399-
keyword-only. Currently, all keyword-only arguments must also be optional
400-
arguments, so ``|`` must always be specified before ``$`` in the format
401-
string.
401+
keyword-only.
402+
They are optional if ``|`` was specified before ``$``, and required otherwise.
403+
``|`` cannot be specified after ``$``.
404+
For example, the format string ``"O|O$O"`` corresponds to the Python
405+
signature ``f(a, b=None, *, c=None)``,
406+
and the format string ``"OO$OO"`` corresponds to ``f(a, b, *, c, d)``.
402407

403408
.. versionadded:: 3.3
404409

pr-preview/pr-1231/_sources/library/argparse.rst.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,12 +1541,12 @@ it exits and prints the error along with a usage message::
15411541
>>> # invalid option
15421542
>>> parser.parse_args(['--bar'])
15431543
usage: PROG [-h] [--foo FOO] [bar]
1544-
PROG: error: no such option: --bar
1544+
PROG: error: unrecognized arguments: --bar
15451545

15461546
>>> # wrong number of arguments
15471547
>>> parser.parse_args(['spam', 'badger'])
15481548
usage: PROG [-h] [--foo FOO] [bar]
1549-
PROG: error: extra arguments found: badger
1549+
PROG: error: unrecognized arguments: badger
15501550

15511551

15521552
Arguments containing ``-``
@@ -1583,7 +1583,7 @@ there are no options in the parser that look like negative numbers::
15831583
>>> # negative number options present, so -2 is an option
15841584
>>> parser.parse_args(['-2'])
15851585
usage: PROG [-h] [-1 ONE] [foo]
1586-
PROG: error: no such option: -2
1586+
PROG: error: unrecognized arguments: -2
15871587

15881588
>>> # negative number options present, so both -1s are options
15891589
>>> parser.parse_args(['-1', '-1'])

pr-preview/pr-1231/_sources/library/asyncio-task.rst.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,17 @@ Creating tasks
288288
# completion:
289289
task.add_done_callback(background_tasks.discard)
290290

291+
Note that this approach never awaits the tasks, so if a task
292+
fails, its exception is never retrieved and asyncio logs a
293+
"Task exception was never retrieved" message when the task is
294+
garbage collected. To avoid this, use :class:`asyncio.TaskGroup`
295+
which keeps a strong reference to each task, awaits them and
296+
propagates their exceptions::
297+
298+
async with asyncio.TaskGroup() as tg:
299+
for i in range(10):
300+
tg.create_task(some_coro(param=i))
301+
291302
.. versionadded:: 3.7
292303

293304
.. versionchanged:: 3.8

pr-preview/pr-1231/about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ <h3>導航</h3>
356356
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
357357
<br>
358358
<br>
359-
最後更新於 8月 07, 2026 (01:19 UTC)。
359+
最後更新於 8月 08, 2026 (00:21 UTC)。
360360

361361
<a href="/bugs.html">發現 bug</a>
362362

pr-preview/pr-1231/bugs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ <h3>導航</h3>
393393
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
394394
<br>
395395
<br>
396-
最後更新於 8月 07, 2026 (01:19 UTC)。
396+
最後更新於 8月 08, 2026 (00:21 UTC)。
397397

398398
<a href="/bugs.html">發現 bug</a>
399399

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ <h3>導航</h3>
365365
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
366366
<br>
367367
<br>
368-
最後更新於 8月 07, 2026 (01:19 UTC)。
368+
最後更新於 8月 08, 2026 (00:21 UTC)。
369369

370370
<a href="/bugs.html">發現 bug</a>
371371

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ <h3>導航</h3>
577577
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
578578
<br>
579579
<br>
580-
最後更新於 8月 07, 2026 (01:19 UTC)。
580+
最後更新於 8月 08, 2026 (00:21 UTC)。
581581

582582
<a href="/bugs.html">發現 bug</a>
583583

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ <h3>導航</h3>
514514
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
515515
<br>
516516
<br>
517-
最後更新於 8月 07, 2026 (01:19 UTC)。
517+
最後更新於 8月 08, 2026 (00:21 UTC)。
518518

519519
<a href="/bugs.html">發現 bug</a>
520520

pr-preview/pr-1231/c-api/arg.html

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -529,13 +529,18 @@ <h3>其他物件<a class="headerlink" href="#other-objects" title="連結到這
529529
The C variables corresponding to optional arguments should be initialized to
530530
their default value --- when an optional argument is not specified,
531531
<a class="reference internal" href="#c.PyArg_ParseTuple" title="PyArg_ParseTuple"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyArg_ParseTuple()</span></code></a> does not touch the contents of the corresponding C
532-
variable(s).</p>
532+
variable(s).
533+
For example, the format string <code class="docutils literal notranslate"><span class="pre">&quot;OO|OO&quot;</span></code> corresponds to the Python
534+
signature <code class="docutils literal notranslate"><span class="pre">f(a,</span> <span class="pre">b,</span> <span class="pre">c=None,</span> <span class="pre">d=None)</span></code>.</p>
533535
</dd>
534536
<dt><code class="docutils literal notranslate"><span class="pre">$</span></code></dt><dd><p><a class="reference internal" href="#c.PyArg_ParseTupleAndKeywords" title="PyArg_ParseTupleAndKeywords"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyArg_ParseTupleAndKeywords()</span></code></a> only:
535537
Indicates that the remaining arguments in the Python argument list are
536-
keyword-only. Currently, all keyword-only arguments must also be optional
537-
arguments, so <code class="docutils literal notranslate"><span class="pre">|</span></code> must always be specified before <code class="docutils literal notranslate"><span class="pre">$</span></code> in the format
538-
string.</p>
538+
keyword-only.
539+
They are optional if <code class="docutils literal notranslate"><span class="pre">|</span></code> was specified before <code class="docutils literal notranslate"><span class="pre">$</span></code>, and required otherwise.
540+
<code class="docutils literal notranslate"><span class="pre">|</span></code> cannot be specified after <code class="docutils literal notranslate"><span class="pre">$</span></code>.
541+
For example, the format string <code class="docutils literal notranslate"><span class="pre">&quot;O|O$O&quot;</span></code> corresponds to the Python
542+
signature <code class="docutils literal notranslate"><span class="pre">f(a,</span> <span class="pre">b=None,</span> <span class="pre">*,</span> <span class="pre">c=None)</span></code>,
543+
and the format string <code class="docutils literal notranslate"><span class="pre">&quot;OO$OO&quot;</span></code> corresponds to <code class="docutils literal notranslate"><span class="pre">f(a,</span> <span class="pre">b,</span> <span class="pre">*,</span> <span class="pre">c,</span> <span class="pre">d)</span></code>.</p>
539544
<div class="versionadded">
540545
<p><span class="versionmodified added">在 3.3 版被加入.</span></p>
541546
</div>
@@ -996,7 +1001,7 @@ <h3>導航</h3>
9961001
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
9971002
<br>
9981003
<br>
999-
最後更新於 8月 07, 2026 (01:19 UTC)。
1004+
最後更新於 8月 08, 2026 (00:21 UTC)。
10001005

10011006
<a href="/bugs.html">發現 bug</a>
10021007

pr-preview/pr-1231/c-api/bool.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ <h3>導航</h3>
376376
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
377377
<br>
378378
<br>
379-
最後更新於 8月 07, 2026 (01:19 UTC)。
379+
最後更新於 8月 08, 2026 (00:21 UTC)。
380380

381381
<a href="/bugs.html">發現 bug</a>
382382

0 commit comments

Comments
 (0)