Skip to content

Commit 0e0b766

Browse files
committed
Deploying to gh-pages from @ 4f4b102 🚀
1 parent 8344dd0 commit 0e0b766

File tree

573 files changed

+1208
-978
lines changed

Some content is hidden

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

573 files changed

+1208
-978
lines changed

_sources/c-api/init.rst.txt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2396,12 +2396,20 @@ per-object locks for :term:`free-threaded <free threading>` CPython. They are
23962396
intended to replace reliance on the :term:`global interpreter lock`, and are
23972397
no-ops in versions of Python with the global interpreter lock.
23982398
2399+
Critical sections are intended to be used for custom types implemented
2400+
in C-API extensions. They should generally not be used with built-in types like
2401+
:class:`list` and :class:`dict` because their public C-APIs
2402+
already use critical sections internally, with the notable
2403+
exception of :c:func:`PyDict_Next`, which requires critical section
2404+
to be acquired externally.
2405+
23992406
Critical sections avoid deadlocks by implicitly suspending active critical
2400-
sections and releasing the locks during calls to :c:func:`PyEval_SaveThread`.
2401-
When :c:func:`PyEval_RestoreThread` is called, the most recent critical section
2402-
is resumed, and its locks reacquired. This means the critical section API
2403-
provides weaker guarantees than traditional locks -- they are useful because
2404-
their behavior is similar to the :term:`GIL`.
2407+
sections, hence, they do not provide exclusive access such as provided by
2408+
traditional locks like :c:type:`PyMutex`. When a critical section is started,
2409+
the per-object lock for the object is acquired. If the code executed inside the
2410+
critical section calls C-API functions then it can suspend the critical section thereby
2411+
releasing the per-object lock, so other threads can acquire the per-object lock
2412+
for the same object.
24052413
24062414
The functions and structs used by the macros are exposed for cases
24072415
where C macros are not available. They should only be used as in the

_sources/extending/extending.rst.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,14 @@ references to all its items, so when item 1 is replaced, it has to dispose of
10841084
the original item 1. Now let's suppose the original item 1 was an instance of a
10851085
user-defined class, and let's further suppose that the class defined a
10861086
:meth:`!__del__` method. If this class instance has a reference count of 1,
1087-
disposing of it will call its :meth:`!__del__` method.
1087+
disposing of it will call its :meth:`!__del__` method. Internally,
1088+
:c:func:`PyList_SetItem` calls :c:func:`Py_DECREF` on the replaced item,
1089+
which invokes replaced item's corresponding
1090+
:c:member:`~PyTypeObject.tp_dealloc` function. During
1091+
deallocation, :c:member:`~PyTypeObject.tp_dealloc` calls
1092+
:c:member:`~PyTypeObject.tp_finalize`, which is mapped to the
1093+
:meth:`!__del__` method for class instances (see :pep:`442`). This entire
1094+
sequence happens synchronously within the :c:func:`PyList_SetItem` call.
10881095

10891096
Since it is written in Python, the :meth:`!__del__` method can execute arbitrary
10901097
Python code. Could it perhaps do something to invalidate the reference to

_sources/glossary.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Glossary
102102
statements.
103103

104104
asynchronous generator iterator
105-
An object created by a :term:`asynchronous generator` function.
105+
An object created by an :term:`asynchronous generator` function.
106106

107107
This is an :term:`asynchronous iterator` which when called using the
108108
:meth:`~object.__anext__` method returns an awaitable object which will execute

_sources/howto/descriptor.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ Here are three practical data validation utilities:
420420

421421
def validate(self, value):
422422
if not isinstance(value, str):
423-
raise TypeError(f'Expected {value!r} to be an str')
423+
raise TypeError(f'Expected {value!r} to be a str')
424424
if self.minsize is not None and len(value) < self.minsize:
425425
raise ValueError(
426426
f'Expected {value!r} to be no smaller than {self.minsize!r}'

_sources/library/csv.rst.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ The :mod:`csv` module defines the following functions:
113113
spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])
114114

115115

116-
.. function:: register_dialect(name[, dialect[, **fmtparams]])
116+
.. function:: register_dialect(name, /, dialect='excel', **fmtparams)
117117

118118
Associate *dialect* with *name*. *name* must be a string. The
119119
dialect can be specified either by passing a sub-class of :class:`Dialect`, or
@@ -139,7 +139,8 @@ The :mod:`csv` module defines the following functions:
139139
Return the names of all registered dialects.
140140

141141

142-
.. function:: field_size_limit([new_limit])
142+
.. function:: field_size_limit()
143+
field_size_limit(new_limit)
143144

144145
Returns the current maximum field size allowed by the parser. If *new_limit* is
145146
given, this becomes the new limit.
@@ -526,7 +527,7 @@ out surrounded by parens. This may cause some problems for other programs which
526527
read CSV files (assuming they support complex numbers at all).
527528

528529

529-
.. method:: csvwriter.writerow(row)
530+
.. method:: csvwriter.writerow(row, /)
530531

531532
Write the *row* parameter to the writer's file object, formatted according
532533
to the current :class:`Dialect`. Return the return value of the call to the
@@ -535,7 +536,7 @@ read CSV files (assuming they support complex numbers at all).
535536
.. versionchanged:: 3.5
536537
Added support of arbitrary iterables.
537538

538-
.. method:: csvwriter.writerows(rows)
539+
.. method:: csvwriter.writerows(rows, /)
539540

540541
Write all elements in *rows* (an iterable of *row* objects as described
541542
above) to the writer's file object, formatted according to the current

_sources/library/exceptions.rst.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,9 @@ The following exceptions are used as warning categories; see the
880880

881881
Base class for warnings about dubious syntax.
882882

883+
This warning is typically emitted when compiling Python source code, and usually won't be reported
884+
when running already compiled code.
885+
883886

884887
.. exception:: RuntimeWarning
885888

0 commit comments

Comments
 (0)