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

Skip to content

Commit c9868d7

Browse files
committed
Deploying to gh-pages from @ f8ef476 🚀
1 parent 55bf6da commit c9868d7

File tree

570 files changed

+8243
-8055
lines changed

Some content is hidden

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

570 files changed

+8243
-8055
lines changed

_sources/c-api/code.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ bound into a function.
182182
Type of a code object watcher callback function.
183183
184184
If *event* is ``PY_CODE_EVENT_CREATE``, then the callback is invoked
185-
after `co` has been fully initialized. Otherwise, the callback is invoked
185+
after *co* has been fully initialized. Otherwise, the callback is invoked
186186
before the destruction of *co* takes place, so the prior state of *co*
187187
can be inspected.
188188

_sources/c-api/function.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ There are a few functions specific to Python functions.
169169
unpredictable effects, including infinite recursion.
170170
171171
If *event* is ``PyFunction_EVENT_CREATE``, then the callback is invoked
172-
after `func` has been fully initialized. Otherwise, the callback is invoked
172+
after *func* has been fully initialized. Otherwise, the callback is invoked
173173
before the modification to *func* takes place, so the prior state of *func*
174174
can be inspected. The runtime is permitted to optimize away the creation of
175175
function objects when possible. In such cases no event will be emitted.

_sources/c-api/typeobj.rst.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Quick Reference
7979
| :c:member:`~PyTypeObject.tp_setattro` | :c:type:`setattrofunc` | __setattr__, | X | X | | G |
8080
| | | __delattr__ | | | | |
8181
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
82-
| :c:member:`~PyTypeObject.tp_as_buffer` | :c:type:`PyBufferProcs` * | | | | | % |
82+
| :c:member:`~PyTypeObject.tp_as_buffer` | :c:type:`PyBufferProcs` * | :ref:`sub-slots` | | | | % |
8383
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
8484
| :c:member:`~PyTypeObject.tp_flags` | unsigned long | | X | X | | ? |
8585
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
@@ -325,9 +325,10 @@ sub-slots
325325
+---------------------------------------------------------+-----------------------------------+---------------+
326326
| |
327327
+---------------------------------------------------------+-----------------------------------+---------------+
328-
| :c:member:`~PyBufferProcs.bf_getbuffer` | :c:func:`getbufferproc` | |
328+
| :c:member:`~PyBufferProcs.bf_getbuffer` | :c:func:`getbufferproc` | __buffer__ |
329329
+---------------------------------------------------------+-----------------------------------+---------------+
330-
| :c:member:`~PyBufferProcs.bf_releasebuffer` | :c:func:`releasebufferproc` | |
330+
| :c:member:`~PyBufferProcs.bf_releasebuffer` | :c:func:`releasebufferproc` | __release_\ |
331+
| | | buffer\__ |
331332
+---------------------------------------------------------+-----------------------------------+---------------+
332333

333334
.. _slot-typedefs-table:
@@ -1186,7 +1187,7 @@ and :c:data:`PyType_Type` effectively act as defaults.)
11861187

11871188
.. c:macro:: Py_TPFLAGS_MANAGED_DICT
11881189
1189-
This bit indicates that instances of the class have a `~object.__dict__`
1190+
This bit indicates that instances of the class have a :attr:`~object.__dict__`
11901191
attribute, and that the space for the dictionary is managed by the VM.
11911192

11921193
If this flag is set, :c:macro:`Py_TPFLAGS_HAVE_GC` should also be set.

_sources/howto/free-threading-extensions.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ The wheels, shared libraries, and binaries are indicated by a ``t`` suffix.
249249
free-threaded build, with the ``t`` suffix, such as ``python3.13t``.
250250
* `pypa/cibuildwheel <https://github.com/pypa/cibuildwheel>`_ supports the
251251
free-threaded build if you set
252-
`CIBW_FREE_THREADED_SUPPORT <https://cibuildwheel.pypa.io/en/stable/options/#free-threaded-support>`_.
252+
`CIBW_ENABLE to cpython-freethreading <https://cibuildwheel.pypa.io/en/stable/options/#enable>`_.
253253

254254
Limited C API and Stable ABI
255255
............................

_sources/howto/free-threading-python.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ optionally support installing free-threaded Python binaries. The installers
3232
are available at https://www.python.org/downloads/.
3333

3434
For information on other platforms, see the `Installing a Free-Threaded Python
35-
<https://py-free-threading.github.io/installing_cpython/>`_, a
35+
<https://py-free-threading.github.io/installing-cpython/>`_, a
3636
community-maintained installation guide for installing free-threaded Python.
3737

3838
When building CPython from source, the :option:`--disable-gil` configure option

_sources/howto/isolating-extensions.rst.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,21 +215,36 @@ multiple interpreters correctly. If this is not yet the case for your
215215
module, you can explicitly make your module loadable only once per
216216
process. For example::
217217

218+
// A process-wide flag
218219
static int loaded = 0;
219220

221+
// Mutex to provide thread safety (only needed for free-threaded Python)
222+
static PyMutex modinit_mutex = {0};
223+
220224
static int
221225
exec_module(PyObject* module)
222226
{
227+
PyMutex_Lock(&modinit_mutex);
223228
if (loaded) {
229+
PyMutex_Unlock(&modinit_mutex);
224230
PyErr_SetString(PyExc_ImportError,
225231
"cannot load module more than once per process");
226232
return -1;
227233
}
228234
loaded = 1;
235+
PyMutex_Unlock(&modinit_mutex);
229236
// ... rest of initialization
230237
}
231238

232239

240+
If your module's :c:member:`PyModuleDef.m_clear` function is able to prepare
241+
for future re-initialization, it should clear the ``loaded`` flag.
242+
In this case, your module won't support multiple instances existing
243+
*concurrently*, but it will, for example, support being loaded after
244+
Python runtime shutdown (:c:func:`Py_FinalizeEx`) and re-initialization
245+
(:c:func:`Py_Initialize`).
246+
247+
233248
Module State Access from Functions
234249
----------------------------------
235250

_sources/library/code.rst.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ build applications which provide an interactive interpreter prompt.
2222
it defaults to a newly created dictionary with key ``'__name__'`` set to
2323
``'__console__'`` and key ``'__doc__'`` set to ``None``.
2424

25+
Note that functions and classes objects created under an
26+
:class:`!InteractiveInterpreter` instance will belong to the namespace
27+
specified by *locals*.
28+
They are only pickleable if *locals* is the namespace of an existing
29+
module.
30+
2531

2632
.. class:: InteractiveConsole(locals=None, filename="<console>", local_exit=False)
2733

_sources/library/decimal.rst.txt

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
=====================================================================
33

44
.. module:: decimal
5-
:synopsis: Implementation of the General Decimal Arithmetic Specification.
5+
:synopsis: Implementation of the General Decimal Arithmetic Specification.
66

77
.. moduleauthor:: Eric Price <eprice at tjhsst.edu>
88
.. moduleauthor:: Facundo Batista <facundo at taniquetil.com.ar>
@@ -121,7 +121,7 @@ reset them before monitoring a calculation.
121121
122122
.. _decimal-tutorial:
123123

124-
Quick-start Tutorial
124+
Quick-start tutorial
125125
--------------------
126126

127127
The usual start to using decimals is importing the module, viewing the current
@@ -1071,40 +1071,52 @@ In addition to the three supplied contexts, new contexts can be created with the
10711071
default values are copied from the :const:`DefaultContext`. If the *flags*
10721072
field is not specified or is :const:`None`, all flags are cleared.
10731073

1074-
*prec* is an integer in the range [``1``, :const:`MAX_PREC`] that sets
1075-
the precision for arithmetic operations in the context.
1074+
.. attribute:: prec
10761075

1077-
The *rounding* option is one of the constants listed in the section
1078-
`Rounding Modes`_.
1076+
An integer in the range [``1``, :const:`MAX_PREC`] that sets
1077+
the precision for arithmetic operations in the context.
10791078

1080-
The *traps* and *flags* fields list any signals to be set. Generally, new
1081-
contexts should only set traps and leave the flags clear.
1079+
.. attribute:: rounding
10821080

1083-
The *Emin* and *Emax* fields are integers specifying the outer limits allowable
1084-
for exponents. *Emin* must be in the range [:const:`MIN_EMIN`, ``0``],
1085-
*Emax* in the range [``0``, :const:`MAX_EMAX`].
1081+
One of the constants listed in the section `Rounding Modes`_.
10861082

1087-
The *capitals* field is either ``0`` or ``1`` (the default). If set to
1088-
``1``, exponents are printed with a capital ``E``; otherwise, a
1089-
lowercase ``e`` is used: ``Decimal('6.02e+23')``.
1083+
.. attribute:: traps
1084+
flags
10901085

1091-
The *clamp* field is either ``0`` (the default) or ``1``.
1092-
If set to ``1``, the exponent ``e`` of a :class:`Decimal`
1093-
instance representable in this context is strictly limited to the
1094-
range ``Emin - prec + 1 <= e <= Emax - prec + 1``. If *clamp* is
1095-
``0`` then a weaker condition holds: the adjusted exponent of
1096-
the :class:`Decimal` instance is at most :attr:`~Context.Emax`. When *clamp* is
1097-
``1``, a large normal number will, where possible, have its
1098-
exponent reduced and a corresponding number of zeros added to its
1099-
coefficient, in order to fit the exponent constraints; this
1100-
preserves the value of the number but loses information about
1101-
significant trailing zeros. For example::
1086+
Lists of any signals to be set. Generally, new contexts should only set
1087+
traps and leave the flags clear.
11021088

1103-
>>> Context(prec=6, Emax=999, clamp=1).create_decimal('1.23e999')
1104-
Decimal('1.23000E+999')
1089+
.. attribute:: Emin
1090+
Emax
11051091

1106-
A *clamp* value of ``1`` allows compatibility with the
1107-
fixed-width decimal interchange formats specified in IEEE 754.
1092+
Integers specifying the outer limits allowable for exponents. *Emin* must
1093+
be in the range [:const:`MIN_EMIN`, ``0``], *Emax* in the range
1094+
[``0``, :const:`MAX_EMAX`].
1095+
1096+
.. attribute:: capitals
1097+
1098+
Either ``0`` or ``1`` (the default). If set to
1099+
``1``, exponents are printed with a capital ``E``; otherwise, a
1100+
lowercase ``e`` is used: ``Decimal('6.02e+23')``.
1101+
1102+
.. attribute:: clamp
1103+
1104+
Either ``0`` (the default) or ``1``. If set to ``1``, the exponent ``e``
1105+
of a :class:`Decimal` instance representable in this context is strictly
1106+
limited to the range ``Emin - prec + 1 <= e <= Emax - prec + 1``.
1107+
If *clamp* is ``0`` then a weaker condition holds: the adjusted exponent of
1108+
the :class:`Decimal` instance is at most :attr:`~Context.Emax`. When *clamp* is
1109+
``1``, a large normal number will, where possible, have its
1110+
exponent reduced and a corresponding number of zeros added to its
1111+
coefficient, in order to fit the exponent constraints; this
1112+
preserves the value of the number but loses information about
1113+
significant trailing zeros. For example::
1114+
1115+
>>> Context(prec=6, Emax=999, clamp=1).create_decimal('1.23e999')
1116+
Decimal('1.23000E+999')
1117+
1118+
A *clamp* value of ``1`` allows compatibility with the
1119+
fixed-width decimal interchange formats specified in IEEE 754.
11081120

11091121
The :class:`Context` class defines several general purpose methods as well as
11101122
a large number of methods for doing arithmetic directly in a given context.
@@ -1743,7 +1755,7 @@ The following table summarizes the hierarchy of signals::
17431755
17441756
.. _decimal-notes:
17451757

1746-
Floating-Point Notes
1758+
Floating-point notes
17471759
--------------------
17481760

17491761

_sources/library/functions.rst.txt

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,44 +1147,44 @@ are always available. They are listed here in alphabetical order.
11471147

11481148
.. function:: locals()
11491149

1150-
Return a mapping object representing the current local symbol table, with
1151-
variable names as the keys, and their currently bound references as the
1152-
values.
1153-
1154-
At module scope, as well as when using :func:`exec` or :func:`eval` with
1155-
a single namespace, this function returns the same namespace as
1156-
:func:`globals`.
1157-
1158-
At class scope, it returns the namespace that will be passed to the
1159-
metaclass constructor.
1160-
1161-
When using ``exec()`` or ``eval()`` with separate local and global
1162-
arguments, it returns the local namespace passed in to the function call.
1163-
1164-
In all of the above cases, each call to ``locals()`` in a given frame of
1165-
execution will return the *same* mapping object. Changes made through
1166-
the mapping object returned from ``locals()`` will be visible as assigned,
1167-
reassigned, or deleted local variables, and assigning, reassigning, or
1168-
deleting local variables will immediately affect the contents of the
1169-
returned mapping object.
1170-
1171-
In an :term:`optimized scope` (including functions, generators, and
1172-
coroutines), each call to ``locals()`` instead returns a fresh dictionary
1173-
containing the current bindings of the function's local variables and any
1174-
nonlocal cell references. In this case, name binding changes made via the
1175-
returned dict are *not* written back to the corresponding local variables
1176-
or nonlocal cell references, and assigning, reassigning, or deleting local
1177-
variables and nonlocal cell references does *not* affect the contents
1178-
of previously returned dictionaries.
1179-
1180-
Calling ``locals()`` as part of a comprehension in a function, generator, or
1181-
coroutine is equivalent to calling it in the containing scope, except that
1182-
the comprehension's initialised iteration variables will be included. In
1183-
other scopes, it behaves as if the comprehension were running as a nested
1184-
function.
1185-
1186-
Calling ``locals()`` as part of a generator expression is equivalent to
1187-
calling it in a nested generator function.
1150+
Return a mapping object representing the current local symbol table, with
1151+
variable names as the keys, and their currently bound references as the
1152+
values.
1153+
1154+
At module scope, as well as when using :func:`exec` or :func:`eval` with
1155+
a single namespace, this function returns the same namespace as
1156+
:func:`globals`.
1157+
1158+
At class scope, it returns the namespace that will be passed to the
1159+
metaclass constructor.
1160+
1161+
When using ``exec()`` or ``eval()`` with separate local and global
1162+
arguments, it returns the local namespace passed in to the function call.
1163+
1164+
In all of the above cases, each call to ``locals()`` in a given frame of
1165+
execution will return the *same* mapping object. Changes made through
1166+
the mapping object returned from ``locals()`` will be visible as assigned,
1167+
reassigned, or deleted local variables, and assigning, reassigning, or
1168+
deleting local variables will immediately affect the contents of the
1169+
returned mapping object.
1170+
1171+
In an :term:`optimized scope` (including functions, generators, and
1172+
coroutines), each call to ``locals()`` instead returns a fresh dictionary
1173+
containing the current bindings of the function's local variables and any
1174+
nonlocal cell references. In this case, name binding changes made via the
1175+
returned dict are *not* written back to the corresponding local variables
1176+
or nonlocal cell references, and assigning, reassigning, or deleting local
1177+
variables and nonlocal cell references does *not* affect the contents
1178+
of previously returned dictionaries.
1179+
1180+
Calling ``locals()`` as part of a comprehension in a function, generator, or
1181+
coroutine is equivalent to calling it in the containing scope, except that
1182+
the comprehension's initialised iteration variables will be included. In
1183+
other scopes, it behaves as if the comprehension were running as a nested
1184+
function.
1185+
1186+
Calling ``locals()`` as part of a generator expression is equivalent to
1187+
calling it in a nested generator function.
11881188

11891189
.. versionchanged:: 3.12
11901190
The behaviour of ``locals()`` in a comprehension has been updated as

_sources/library/hashlib.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ a file or file-like object.
284284
Example:
285285

286286
>>> import io, hashlib, hmac
287-
>>> with open(hashlib.__file__, "rb") as f:
287+
>>> with open("library/hashlib.rst", "rb") as f:
288288
... digest = hashlib.file_digest(f, "sha256")
289289
...
290290
>>> digest.hexdigest() # doctest: +ELLIPSIS

_sources/library/importlib.resources.abc.rst.txt

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -49,44 +49,44 @@
4949
.. method:: open_resource(resource)
5050
:abstractmethod:
5151

52-
Returns an opened, :term:`file-like object` for binary reading
53-
of the *resource*.
52+
Returns an opened, :term:`file-like object` for binary reading
53+
of the *resource*.
5454

55-
If the resource cannot be found, :exc:`FileNotFoundError` is
56-
raised.
55+
If the resource cannot be found, :exc:`FileNotFoundError` is
56+
raised.
5757

5858
.. method:: resource_path(resource)
5959
:abstractmethod:
6060

61-
Returns the file system path to the *resource*.
61+
Returns the file system path to the *resource*.
6262

63-
If the resource does not concretely exist on the file system,
64-
raise :exc:`FileNotFoundError`.
63+
If the resource does not concretely exist on the file system,
64+
raise :exc:`FileNotFoundError`.
6565

6666
.. method:: is_resource(name)
6767
:abstractmethod:
6868

69-
Returns ``True`` if the named *name* is considered a resource.
70-
:exc:`FileNotFoundError` is raised if *name* does not exist.
69+
Returns ``True`` if the named *name* is considered a resource.
70+
:exc:`FileNotFoundError` is raised if *name* does not exist.
7171

7272
.. method:: contents()
7373
:abstractmethod:
7474

75-
Returns an :term:`iterable` of strings over the contents of
76-
the package. Do note that it is not required that all names
77-
returned by the iterator be actual resources, e.g. it is
78-
acceptable to return names for which :meth:`is_resource` would
79-
be false.
80-
81-
Allowing non-resource names to be returned is to allow for
82-
situations where how a package and its resources are stored
83-
are known a priori and the non-resource names would be useful.
84-
For instance, returning subdirectory names is allowed so that
85-
when it is known that the package and resources are stored on
86-
the file system then those subdirectory names can be used
87-
directly.
88-
89-
The abstract method returns an iterable of no items.
75+
Returns an :term:`iterable` of strings over the contents of
76+
the package. Do note that it is not required that all names
77+
returned by the iterator be actual resources, e.g. it is
78+
acceptable to return names for which :meth:`is_resource` would
79+
be false.
80+
81+
Allowing non-resource names to be returned is to allow for
82+
situations where how a package and its resources are stored
83+
are known a priori and the non-resource names would be useful.
84+
For instance, returning subdirectory names is allowed so that
85+
when it is known that the package and resources are stored on
86+
the file system then those subdirectory names can be used
87+
directly.
88+
89+
The abstract method returns an iterable of no items.
9090

9191

9292
.. class:: Traversable

0 commit comments

Comments
 (0)