Skip to content

Commit 361ed44

Browse files
committed
Deploying to gh-pages from @ c4c0d58 🚀
1 parent 5e54bd7 commit 361ed44

File tree

576 files changed

+9662
-8881
lines changed

Some content is hidden

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

576 files changed

+9662
-8881
lines changed

.buildinfo

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 0e07bb20b6755b9c2da536565da9cbbd
3+
config: 1b44886422cbc702b5b11fb043c64e25
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

_sources/c-api/frame.rst.txt

+21-1
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,34 @@ See also :ref:`Reflection <reflection>`.
132132
.. versionadded:: 3.11
133133
134134
.. versionchanged:: 3.13
135-
As part of :pep:`667`, return a proxy object for optimized scopes.
135+
As part of :pep:`667`, return an instance of :c:var:`PyFrameLocalsProxy_Type`.
136136
137137
138138
.. c:function:: int PyFrame_GetLineNumber(PyFrameObject *frame)
139139
140140
Return the line number that *frame* is currently executing.
141141
142142
143+
Frame Locals Proxies
144+
^^^^^^^^^^^^^^^^^^^^
145+
146+
.. versionadded:: 3.13
147+
148+
The :attr:`~frame.f_locals` attribute on a :ref:`frame object <frame-objects>`
149+
is an instance of a "frame-locals proxy". The proxy object exposes a
150+
write-through view of the underlying locals dictionary for the frame. This
151+
ensures that the variables exposed by ``f_locals`` are always up to date with
152+
the live local variables in the frame itself.
153+
154+
See :pep:`667` for more information.
155+
156+
.. c:var:: PyTypeObject PyFrameLocalsProxy_Type
157+
158+
The type of frame :func:`locals` proxy objects.
159+
160+
.. c:function:: int PyFrameLocalsProxy_Check(PyObject *obj)
161+
162+
Return non-zero if *obj* is a frame :func:`locals` proxy.
143163
144164
Internal Frames
145165
^^^^^^^^^^^^^^^

_sources/c-api/init.rst.txt

+9
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,15 @@ Initializing and finalizing the interpreter
557557
customized Python that always runs in isolated mode using
558558
:c:func:`Py_RunMain`.
559559
560+
.. c:function:: int PyUnstable_AtExit(PyInterpreterState *interp, void (*func)(void *), void *data)
561+
562+
Register an :mod:`atexit` callback for the target interpreter *interp*.
563+
This is similar to :c:func:`Py_AtExit`, but takes an explicit interpreter and
564+
data pointer for the callback.
565+
566+
The :term:`GIL` must be held for *interp*.
567+
568+
.. versionadded:: 3.13
560569
561570
Process-wide parameters
562571
=======================

_sources/c-api/init_config.rst.txt

+11
Original file line numberDiff line numberDiff line change
@@ -1271,6 +1271,17 @@ PyConfig
12711271
12721272
Default: ``1`` in Python config and ``0`` in isolated config.
12731273
1274+
.. c:member:: int use_system_logger
1275+
1276+
If non-zero, ``stdout`` and ``stderr`` will be redirected to the system
1277+
log.
1278+
1279+
Only available on macOS 10.12 and later, and on iOS.
1280+
1281+
Default: ``0`` (don't use system log).
1282+
1283+
.. versionadded:: 3.13.2
1284+
12741285
.. c:member:: int user_site_directory
12751286
12761287
If non-zero, add the user site directory to :data:`sys.path`.

_sources/c-api/object.rst.txt

+6
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,12 @@ Object Protocol
509509
iterated.
510510
511511
512+
.. c:function:: PyObject* PyObject_SelfIter(PyObject *obj)
513+
514+
This is equivalent to the Python ``__iter__(self): return self`` method.
515+
It is intended for :term:`iterator` types, to be used in the :c:member:`PyTypeObject.tp_iter` slot.
516+
517+
512518
.. c:function:: PyObject* PyObject_GetAIter(PyObject *o)
513519
514520
This is the equivalent to the Python expression ``aiter(o)``. Takes an

_sources/c-api/stable.rst.txt

+11-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Limited C API
6666

6767
Python 3.2 introduced the *Limited API*, a subset of Python's C API.
6868
Extensions that only use the Limited API can be
69-
compiled once and work with multiple versions of Python.
69+
compiled once and be loaded on multiple versions of Python.
7070
Contents of the Limited API are :ref:`listed below <limited-api-list>`.
7171

7272
.. c:macro:: Py_LIMITED_API
@@ -76,7 +76,7 @@ Contents of the Limited API are :ref:`listed below <limited-api-list>`.
7676

7777
Define ``Py_LIMITED_API`` to the value of :c:macro:`PY_VERSION_HEX`
7878
corresponding to the lowest Python version your extension supports.
79-
The extension will work without recompilation with all Python 3 releases
79+
The extension will be ABI-compatible with all Python 3 releases
8080
from the specified one onward, and can use Limited API introduced up to that
8181
version.
8282

@@ -94,7 +94,15 @@ Stable ABI
9494
----------
9595

9696
To enable this, Python provides a *Stable ABI*: a set of symbols that will
97-
remain compatible across Python 3.x versions.
97+
remain ABI-compatible across Python 3.x versions.
98+
99+
.. note::
100+
101+
The Stable ABI prevents ABI issues, like linker errors due to missing
102+
symbols or data corruption due to changes in structure layouts or function
103+
signatures.
104+
However, other changes in Python can change the *behavior* of extensions.
105+
See Python's Backwards Compatibility Policy (:pep:`387`) for details.
98106

99107
The Stable ABI contains symbols exposed in the :ref:`Limited API
100108
<limited-c-api>`, but also other ones – for example, functions necessary to

_sources/c-api/sys.rst.txt

+4
Original file line numberDiff line numberDiff line change
@@ -426,3 +426,7 @@ Process Control
426426
function registered last is called first. Each cleanup function will be called
427427
at most once. Since Python's internal finalization will have completed before
428428
the cleanup function, no Python APIs should be called by *func*.
429+
430+
.. seealso::
431+
432+
:c:func:`PyUnstable_AtExit` for passing a ``void *data`` argument.

_sources/howto/gdb_helpers.rst.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ regular machine-level integer::
180180
(gdb) p some_python_integer
181181
$4 = 42
182182

183-
The internal structure can be revealed with a cast to :c:expr:`PyLongObject *`:
183+
The internal structure can be revealed with a cast to :c:expr:`PyLongObject *`::
184184

185185
(gdb) p *(PyLongObject*)some_python_integer
186186
$5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1},

_sources/library/ast.rst.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1802,15 +1802,15 @@ aliases.
18021802

18031803
.. doctest::
18041804

1805-
>>> print(ast.dump(ast.parse("type Alias[**P = (int, str)] = Callable[P, int]"), indent=4))
1805+
>>> print(ast.dump(ast.parse("type Alias[**P = [int, str]] = Callable[P, int]"), indent=4))
18061806
Module(
18071807
body=[
18081808
TypeAlias(
18091809
name=Name(id='Alias', ctx=Store()),
18101810
type_params=[
18111811
ParamSpec(
18121812
name='P',
1813-
default_value=Tuple(
1813+
default_value=List(
18141814
elts=[
18151815
Name(id='int', ctx=Load()),
18161816
Name(id='str', ctx=Load())],

_sources/library/collections.rst.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -783,10 +783,10 @@ sequence of key-value pairs into a dictionary of lists:
783783

784784
When each key is encountered for the first time, it is not already in the
785785
mapping; so an entry is automatically created using the :attr:`~defaultdict.default_factory`
786-
function which returns an empty :class:`list`. The :meth:`list.append`
786+
function which returns an empty :class:`list`. The :meth:`!list.append`
787787
operation then attaches the value to the new list. When keys are encountered
788788
again, the look-up proceeds normally (returning the list for that key) and the
789-
:meth:`list.append` operation adds another value to the list. This technique is
789+
:meth:`!list.append` operation adds another value to the list. This technique is
790790
simpler and faster than an equivalent technique using :meth:`dict.setdefault`:
791791

792792
>>> d = {}

_sources/library/dis.rst.txt

+21
Original file line numberDiff line numberDiff line change
@@ -1383,6 +1383,13 @@ iterations of the loop.
13831383
This opcode is now only used in situations where the local variable is
13841384
guaranteed to be initialized. It cannot raise :exc:`UnboundLocalError`.
13851385

1386+
.. opcode:: LOAD_FAST_LOAD_FAST (var_nums)
1387+
1388+
Pushes references to ``co_varnames[var_nums >> 4]`` and
1389+
``co_varnames[var_nums & 15]`` onto the stack.
1390+
1391+
.. versionadded:: 3.13
1392+
13861393
.. opcode:: LOAD_FAST_CHECK (var_num)
13871394

13881395
Pushes a reference to the local ``co_varnames[var_num]`` onto the stack,
@@ -1403,6 +1410,20 @@ iterations of the loop.
14031410

14041411
Stores ``STACK.pop()`` into the local ``co_varnames[var_num]``.
14051412

1413+
.. opcode:: STORE_FAST_STORE_FAST (var_nums)
1414+
1415+
Stores ``STACK[-1]`` into ``co_varnames[var_nums >> 4]``
1416+
and ``STACK[-2]`` into ``co_varnames[var_nums & 15]``.
1417+
1418+
.. versionadded:: 3.13
1419+
1420+
.. opcode:: STORE_FAST_LOAD_FAST (var_nums)
1421+
1422+
Stores ``STACK.pop()`` into the local ``co_varnames[var_nums >> 4]``
1423+
and pushes a reference to the local ``co_varnames[var_nums & 15]``
1424+
onto the stack.
1425+
1426+
.. versionadded:: 3.13
14061427

14071428
.. opcode:: DELETE_FAST (var_num)
14081429

_sources/library/http.cookies.rst.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Cookie Objects
9898
.. method:: BaseCookie.output(attrs=None, header='Set-Cookie:', sep='\r\n')
9999

100100
Return a string representation suitable to be sent as HTTP headers. *attrs* and
101-
*header* are sent to each :class:`Morsel`'s :meth:`output` method. *sep* is used
101+
*header* are sent to each :class:`Morsel`'s :meth:`~Morsel.output` method. *sep* is used
102102
to join the headers together, and is by default the combination ``'\r\n'``
103103
(CRLF).
104104

_sources/library/itertools.rst.txt

+37
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,11 @@ and :term:`generators <generator>` which incur interpreter overhead.
877877
"Returns the sequence elements n times."
878878
return chain.from_iterable(repeat(tuple(iterable), n))
879879

880+
def loops(n):
881+
"Loop n times. Like range(n) but without creating integers."
882+
# for _ in loops(100): ...
883+
return repeat(None, n)
884+
880885
def tail(n, iterable):
881886
"Return an iterator over the last n items."
882887
# tail(3, 'ABCDEFG') → E F G
@@ -1099,6 +1104,11 @@ The following recipes have a more mathematical flavor:
10991104
data[p*p : n : p+p] = bytes(len(range(p*p, n, p+p)))
11001105
yield from iter_index(data, 1, start=3)
11011106

1107+
def is_prime(n):
1108+
"Return True if n is prime."
1109+
# is_prime(1_000_000_000_000_403) → True
1110+
return n > 1 and all(n % p for p in sieve(math.isqrt(n) + 1))
1111+
11021112
def factor(n):
11031113
"Prime factors of n."
11041114
# factor(99) → 3 3 11
@@ -1202,6 +1212,16 @@ The following recipes have a more mathematical flavor:
12021212
[0, 2, 4, 6]
12031213

12041214

1215+
>>> for _ in loops(5):
1216+
... print('hi')
1217+
...
1218+
hi
1219+
hi
1220+
hi
1221+
hi
1222+
hi
1223+
1224+
12051225
>>> list(tail(3, 'ABCDEFG'))
12061226
['E', 'F', 'G']
12071227
>>> # Verify the input is consumed greedily
@@ -1475,6 +1495,23 @@ The following recipes have a more mathematical flavor:
14751495
True
14761496

14771497

1498+
>>> small_primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
1499+
>>> list(filter(is_prime, range(-100, 100))) == small_primes
1500+
True
1501+
>>> carmichael = {561, 1105, 1729, 2465, 2821, 6601, 8911} # https://oeis.org/A002997
1502+
>>> any(map(is_prime, carmichael))
1503+
False
1504+
>>> # https://www.wolframalpha.com/input?i=is+128884753939+prime
1505+
>>> is_prime(128_884_753_939) # large prime
1506+
True
1507+
>>> is_prime(999953 * 999983) # large semiprime
1508+
False
1509+
>>> is_prime(1_000_000_000_000_007) # factor() example
1510+
False
1511+
>>> is_prime(1_000_000_000_000_403) # factor() example
1512+
True
1513+
1514+
14781515
>>> list(factor(99)) # Code example 1
14791516
[3, 3, 11]
14801517
>>> list(factor(1_000_000_000_000_007)) # Code example 2

_sources/library/string.rst.txt

+8-1
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,9 @@ conversions, trailing zeros are not removed from the result.
409409

410410
.. index:: single: , (comma); in string formatting
411411

412-
The ``','`` option signals the use of a comma for a thousands separator.
412+
The ``','`` option signals the use of a comma for a thousands separator for
413+
floating-point presentation types and for integer presentation type ``'d'``.
414+
For other presentation types, this option is an error.
413415
For a locale aware separator, use the ``'n'`` integer presentation type
414416
instead.
415417

@@ -589,6 +591,11 @@ The available presentation types for :class:`float` and
589591
| | as altered by the other format modifiers. |
590592
+---------+----------------------------------------------------------+
591593

594+
The result should be correctly rounded to a given precision ``p`` of digits
595+
after the decimal point. The rounding mode for :class:`float` matches that
596+
of the :func:`round` builtin. For :class:`~decimal.Decimal`, the rounding
597+
mode of the current :ref:`context <decimal-context>` will be used.
598+
592599
The available presentation types for :class:`complex` are the same as those for
593600
:class:`float` (``'%'`` is not allowed). Both the real and imaginary components
594601
of a complex number are formatted as floating-point numbers, according to the

_sources/library/sys.rst.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ always available.
944944
This function should be used for specialized purposes only.
945945
It is not guaranteed to exist in all implementations of Python.
946946

947-
.. versionchanged:: next
947+
.. versionchanged:: 3.13.1
948948

949949
The result may include objects from other interpreters.
950950

_sources/library/traceback.rst.txt

+8-1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@ Module-Level Functions
157157
arguments have the same meaning as for :func:`print_stack`.
158158

159159

160+
.. function:: print_list(extracted_list, file=None)
161+
162+
Print the list of tuples as returned by :func:`extract_tb` or
163+
:func:`extract_stack` as a formatted stack trace to the given file.
164+
If *file* is ``None``, the output is written to :data:`sys.stderr`.
165+
166+
160167
.. function:: format_list(extracted_list)
161168

162169
Given a list of tuples or :class:`FrameSummary` objects as returned by
@@ -263,7 +270,7 @@ Module-Level Functions
263270
:class:`!TracebackException` objects are created from actual exceptions to
264271
capture data for later printing. They offer a more lightweight method of
265272
storing this information by avoiding holding references to
266-
:ref:`traceback<traceback-objects>` and :ref:`frame<frame-objects>` objects
273+
:ref:`traceback<traceback-objects>` and :ref:`frame<frame-objects>` objects.
267274
In addition, they expose more options to configure the output compared to
268275
the module-level functions described above.
269276

_sources/library/xmlrpc.client.rst.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ between conformable Python objects and XML on the wire.
6464
The obsolete *use_datetime* flag is similar to *use_builtin_types* but it
6565
applies only to date/time values.
6666

67-
.. versionchanged:: 3.3
68-
The *use_builtin_types* flag was added.
67+
.. versionchanged:: 3.3
68+
The *use_builtin_types* flag was added.
6969

70-
.. versionchanged:: 3.8
71-
The *headers* parameter was added.
70+
.. versionchanged:: 3.8
71+
The *headers* parameter was added.
7272

7373
Both the HTTP and HTTPS transports support the URL syntax extension for HTTP
7474
Basic Authentication: ``http://user:pass@host:port/path``. The ``user:pass``

_sources/library/xmlrpc.rst.txt

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
:mod:`!xmlrpc` --- XMLRPC server and client modules
22
===================================================
33

4+
.. module:: xmlrpc
5+
:synopsis: Server and client modules implementing XML-RPC.
6+
47
XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP as a
58
transport. With it, a client can call methods with parameters on a remote
69
server (the server is named by a URI) and get back structured data.

0 commit comments

Comments
 (0)