Skip to content

Commit 7913353

Browse files
Deploy preview for PR 1174 🛫
1 parent 8642bfa commit 7913353

File tree

578 files changed

+838
-603
lines changed

Some content is hidden

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

578 files changed

+838
-603
lines changed

pr-preview/pr-1174/_sources/c-api/import.rst.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,13 @@ Importing Modules
327327
initialization.
328328
329329
330+
.. c:var:: struct _inittab *PyImport_Inittab
331+
332+
The table of built-in modules used by Python initialization. Do not use this directly;
333+
use :c:func:`PyImport_AppendInittab` and :c:func:`PyImport_ExtendInittab`
334+
instead.
335+
336+
330337
.. c:function:: PyObject* PyImport_ImportModuleAttr(PyObject *mod_name, PyObject *attr_name)
331338
332339
Import the module *mod_name* and get its attribute *attr_name*.

pr-preview/pr-1174/_sources/c-api/intro.rst.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,19 @@ complete listing.
322322
PyDoc_VAR(python_doc) = PyDoc_STR("A genus of constricting snakes in the Pythonidae family native "
323323
"to the tropics and subtropics of the Eastern Hemisphere.");
324324

325+
.. c:macro:: Py_ARRAY_LENGTH(array)
326+
327+
Compute the length of a statically allocated C array at compile time.
328+
329+
The *array* argument must be a C array with a size known at compile time.
330+
Passing an array with an unknown size, such as a heap-allocated array,
331+
will result in a compilation error on some compilers, or otherwise produce
332+
incorrect results.
333+
334+
This is roughly equivalent to::
335+
336+
sizeof(array) / sizeof((array)[0])
337+
325338

326339
.. _api-objects:
327340

pr-preview/pr-1174/_sources/c-api/veryhigh.rst.txt

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,3 +396,43 @@ Available start symbols
396396
* :pep:`484`
397397
398398
.. versionadded:: 3.8
399+
400+
401+
Stack Effects
402+
^^^^^^^^^^^^^
403+
404+
.. seealso::
405+
:py:func:`dis.stack_effect`
406+
407+
408+
.. c:macro:: PY_INVALID_STACK_EFFECT
409+
410+
Sentinel value representing an invalid stack effect.
411+
412+
This is currently equivalent to ``INT_MAX``.
413+
414+
.. versionadded:: 3.8
415+
416+
417+
.. c:function:: int PyCompile_OpcodeStackEffect(int opcode, int oparg)
418+
419+
Compute the stack effect of *opcode* with argument *oparg*.
420+
421+
On success, this function returns the stack effect; on failure, this
422+
returns :c:macro:`PY_INVALID_STACK_EFFECT`.
423+
424+
.. versionadded:: 3.4
425+
426+
427+
.. c:function:: int PyCompile_OpcodeStackEffectWithJump(int opcode, int oparg, int jump)
428+
429+
Similar to :c:func:`PyCompile_OpcodeStackEffect`, but don't include the
430+
stack effect of jumping if *jump* is zero.
431+
432+
If *jump* is ``0``, this will not include the stack effect of jumping, but
433+
if *jump* is ``1`` or ``-1``, this will include it.
434+
435+
On success, this function returns the stack effect; on failure, this
436+
returns :c:macro:`PY_INVALID_STACK_EFFECT`.
437+
438+
.. versionadded:: 3.8

pr-preview/pr-1174/_sources/extending/extending.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ A pointer to the module definition must be returned via :c:func:`PyModuleDef_Ini
426426
so that the import machinery can create the module and store it in ``sys.modules``.
427427

428428
When embedding Python, the :c:func:`!PyInit_spam` function is not called
429-
automatically unless there's an entry in the :c:data:`!PyImport_Inittab` table.
429+
automatically unless there's an entry in the :c:data:`PyImport_Inittab` table.
430430
To add the module to the initialization table, use :c:func:`PyImport_AppendInittab`,
431431
optionally followed by an import of the module::
432432

pr-preview/pr-1174/_sources/howto/unicode.rst.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,8 @@ If you don't include such a comment, the default encoding used will be UTF-8 as
352352
already mentioned. See also :pep:`263` for more information.
353353

354354

355+
.. _unicode-properties:
356+
355357
Unicode Properties
356358
------------------
357359

pr-preview/pr-1174/_sources/library/stdtypes.rst.txt

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1994,10 +1994,16 @@ expression support in the :mod:`re` module).
19941994
``{}``. Each replacement field contains either the numeric index of a
19951995
positional argument, or the name of a keyword argument. Returns a copy of
19961996
the string where each replacement field is replaced with the string value of
1997-
the corresponding argument.
1997+
the corresponding argument. For example:
1998+
1999+
.. doctest::
19982000

19992001
>>> "The sum of 1 + 2 is {0}".format(1+2)
20002002
'The sum of 1 + 2 is 3'
2003+
>>> "The sum of {a} + {b} is {answer}".format(answer=1+2, a=1, b=2)
2004+
'The sum of 1 + 2 is 3'
2005+
>>> "{1} expects the {0} Inquisition!".format("Spanish", "Nobody")
2006+
'Nobody expects the Spanish Inquisition!'
20012007

20022008
See :ref:`formatstrings` for a description of the various formatting options
20032009
that can be specified in format strings.
@@ -2057,13 +2063,32 @@ expression support in the :mod:`re` module).
20572063
from the `Alphabetic property defined in the section 4.10 'Letters, Alphabetic, and
20582064
Ideographic' of the Unicode Standard
20592065
<https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-4/#G91002>`_.
2066+
For example:
2067+
2068+
.. doctest::
2069+
2070+
>>> 'Letters and spaces'.isalpha()
2071+
False
2072+
>>> 'LettersOnly'.isalpha()
2073+
True
2074+
>>> 'µ'.isalpha() # non-ASCII characters can be considered alphabetical too
2075+
True
2076+
2077+
See :ref:`unicode-properties`.
20602078

20612079

20622080
.. method:: str.isascii()
20632081

20642082
Return ``True`` if the string is empty or all characters in the string are ASCII,
20652083
``False`` otherwise.
2066-
ASCII characters have code points in the range U+0000-U+007F.
2084+
ASCII characters have code points in the range U+0000-U+007F. For example:
2085+
2086+
.. doctest::
2087+
2088+
>>> 'ASCII characters'.isascii()
2089+
True
2090+
>>> 'µ'.isascii()
2091+
False
20672092

20682093
.. versionadded:: 3.7
20692094

@@ -2073,9 +2098,18 @@ expression support in the :mod:`re` module).
20732098
Return ``True`` if all characters in the string are decimal
20742099
characters and there is at least one character, ``False``
20752100
otherwise. Decimal characters are those that can be used to form
2076-
numbers in base 10, e.g. U+0660, ARABIC-INDIC DIGIT
2101+
numbers in base 10, such as U+0660, ARABIC-INDIC DIGIT
20772102
ZERO. Formally a decimal character is a character in the Unicode
2078-
General Category "Nd".
2103+
General Category "Nd". For example:
2104+
2105+
.. doctest::
2106+
2107+
>>> '0123456789'.isdecimal()
2108+
True
2109+
>>> '٠١٢٣٤٥٦٧٨٩'.isdecimal() # Arabic-Indic digits zero to nine
2110+
True
2111+
>>> 'alphabetic'.isdecimal()
2112+
False
20792113

20802114

20812115
.. method:: str.isdigit()
@@ -2194,7 +2228,16 @@ expression support in the :mod:`re` module).
21942228
Return a string which is the concatenation of the strings in *iterable*.
21952229
A :exc:`TypeError` will be raised if there are any non-string values in
21962230
*iterable*, including :class:`bytes` objects. The separator between
2197-
elements is the string providing this method.
2231+
elements is the string providing this method. For example:
2232+
2233+
.. doctest::
2234+
2235+
>>> ', '.join(['spam', 'spam', 'spam'])
2236+
'spam, spam, spam'
2237+
>>> '-'.join('Python')
2238+
'P-y-t-h-o-n'
2239+
2240+
See also :meth:`split`.
21982241

21992242

22002243
.. method:: str.ljust(width, fillchar=' ', /)
@@ -2408,6 +2451,8 @@ expression support in the :mod:`re` module).
24082451
>>> " foo ".split(maxsplit=0)
24092452
['foo ']
24102453

2454+
See also :meth:`join`.
2455+
24112456

24122457
.. index::
24132458
single: universal newlines; str.splitlines method

pr-preview/pr-1174/about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ <h3>導航</h3>
314314
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
315315
<br>
316316
<br>
317-
最後更新於 11月 24, 2025 (00:21 UTC)。
317+
最後更新於 11月 25, 2025 (00:19 UTC)。
318318

319319
<a href="/bugs.html">發現 bug</a>
320320

pr-preview/pr-1174/bugs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ <h3>導航</h3>
351351
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
352352
<br>
353353
<br>
354-
最後更新於 11月 24, 2025 (00:21 UTC)。
354+
最後更新於 11月 25, 2025 (00:19 UTC)。
355355

356356
<a href="/bugs.html">發現 bug</a>
357357

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ <h3>導航</h3>
323323
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
324324
<br>
325325
<br>
326-
最後更新於 11月 24, 2025 (00:21 UTC)。
326+
最後更新於 11月 25, 2025 (00:19 UTC)。
327327

328328
<a href="/bugs.html">發現 bug</a>
329329

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ <h3>導航</h3>
532532
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
533533
<br>
534534
<br>
535-
最後更新於 11月 24, 2025 (00:21 UTC)。
535+
最後更新於 11月 25, 2025 (00:19 UTC)。
536536

537537
<a href="/bugs.html">發現 bug</a>
538538

0 commit comments

Comments
 (0)