Skip to content

Commit d496eab

Browse files
authored
Merge branch 'main' into issue-99631-2
2 parents 53d5557 + 1446024 commit d496eab

File tree

81 files changed

+1067
-202
lines changed

Some content is hidden

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

81 files changed

+1067
-202
lines changed

Doc/c-api/init.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ Process-wide parameters
699699
It is recommended that applications embedding the Python interpreter
700700
for purposes other than executing a single script pass ``0`` as *updatepath*,
701701
and update :data:`sys.path` themselves if desired.
702-
See `CVE-2008-5983 <https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-5983>`_.
702+
See :cve:`2008-5983`.
703703
704704
On versions before 3.1.3, you can achieve the same effect by manually
705705
popping the first :data:`sys.path` element after having called

Doc/c-api/tuple.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ Tuple Objects
5959
Return the object at position *pos* in the tuple pointed to by *p*. If *pos* is
6060
negative or out of bounds, return ``NULL`` and set an :exc:`IndexError` exception.
6161
62+
The returned reference is borrowed from the tuple *p*
63+
(that is: it is only valid as long as you hold a reference to *p*).
64+
To get a :term:`strong reference`, use
65+
:c:func:`Py_NewRef(PyTuple_GetItem(...)) <Py_NewRef>`
66+
or :c:func:`PySequence_GetItem`.
67+
6268
6369
.. c:function:: PyObject* PyTuple_GET_ITEM(PyObject *p, Py_ssize_t pos)
6470

Doc/c-api/typeobj.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,8 @@ and :c:data:`PyType_Type` effectively act as defaults.)
10341034
the type, and the type object is INCREF'ed when a new instance is created, and
10351035
DECREF'ed when an instance is destroyed (this does not apply to instances of
10361036
subtypes; only the type referenced by the instance's ob_type gets INCREF'ed or
1037-
DECREF'ed).
1037+
DECREF'ed). Heap types should also :ref:`support garbage collection <supporting-cycle-detection>`
1038+
as they can form a reference cycle with their own module object.
10381039

10391040
**Inheritance:**
10401041

Doc/library/ast.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2536,7 +2536,8 @@ to stdout. Otherwise, the content is read from stdin.
25362536
code that generated them. This is helpful for tools that make source code
25372537
transformations.
25382538

2539-
`leoAst.py <https://leoeditor.com/appendices.html#leoast-py>`_ unifies the
2539+
`leoAst.py <https://leo-editor.github.io/leo-editor/appendices.html#leoast-py>`_
2540+
unifies the
25402541
token-based and parse-tree-based views of python programs by inserting
25412542
two-way links between tokens and ast nodes.
25422543

@@ -2548,4 +2549,4 @@ to stdout. Otherwise, the content is read from stdin.
25482549
`Parso <https://parso.readthedocs.io>`_ is a Python parser that supports
25492550
error recovery and round-trip parsing for different Python versions (in
25502551
multiple Python versions). Parso is also able to list multiple syntax errors
2551-
in your python file.
2552+
in your Python file.

Doc/library/bz2.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ The :mod:`bz2` module contains:
9191
and :meth:`~io.IOBase.truncate`.
9292
Iteration and the :keyword:`with` statement are supported.
9393

94-
:class:`BZ2File` also provides the following methods:
94+
:class:`BZ2File` also provides the following methods and attributes:
9595

9696
.. method:: peek([n])
9797

@@ -148,6 +148,19 @@ The :mod:`bz2` module contains:
148148

149149
.. versionadded:: 3.3
150150

151+
.. attribute:: mode
152+
153+
``'rb'`` for reading and ``'wb'`` for writing.
154+
155+
.. versionadded:: 3.13
156+
157+
.. attribute:: name
158+
159+
The bzip2 file name. Equivalent to the :attr:`~io.FileIO.name`
160+
attribute of the underlying :term:`file object`.
161+
162+
.. versionadded:: 3.13
163+
151164

152165
.. versionchanged:: 3.1
153166
Support for the :keyword:`with` statement was added.

Doc/library/doctest.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -800,18 +800,18 @@ guarantee about output. For example, when printing a set, Python doesn't
800800
guarantee that the element is printed in any particular order, so a test like ::
801801

802802
>>> foo()
803-
{"Hermione", "Harry"}
803+
{"spam", "eggs"}
804804

805805
is vulnerable! One workaround is to do ::
806806

807-
>>> foo() == {"Hermione", "Harry"}
807+
>>> foo() == {"spam", "eggs"}
808808
True
809809

810810
instead. Another is to do ::
811811

812812
>>> d = sorted(foo())
813813
>>> d
814-
['Harry', 'Hermione']
814+
['eggs', 'spam']
815815

816816
There are others, but you get the idea.
817817

Doc/library/gzip.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ The module defines the following items:
133133

134134
.. versionadded:: 3.2
135135

136+
.. attribute:: mode
137+
138+
``'rb'`` for reading and ``'wb'`` for writing.
139+
140+
.. versionchanged:: 3.13
141+
In previous versions it was an integer ``1`` or ``2``.
142+
136143
.. attribute:: mtime
137144

138145
When decompressing, this attribute is set to the last timestamp in the most
@@ -168,14 +175,14 @@ The module defines the following items:
168175
.. versionchanged:: 3.6
169176
Accepts a :term:`path-like object`.
170177

171-
.. versionchanged:: 3.12
172-
Remove the ``filename`` attribute, use the :attr:`~GzipFile.name`
173-
attribute instead.
174-
175178
.. deprecated:: 3.9
176179
Opening :class:`GzipFile` for writing without specifying the *mode*
177180
argument is deprecated.
178181

182+
.. versionchanged:: 3.12
183+
Remove the ``filename`` attribute, use the :attr:`~GzipFile.name`
184+
attribute instead.
185+
179186

180187
.. function:: compress(data, compresslevel=9, *, mtime=None)
181188

Doc/library/lzma.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Reading and writing compressed files
104104
and :meth:`~io.IOBase.truncate`.
105105
Iteration and the :keyword:`with` statement are supported.
106106

107-
The following method is also provided:
107+
The following method and attributes are also provided:
108108

109109
.. method:: peek(size=-1)
110110

@@ -117,6 +117,20 @@ Reading and writing compressed files
117117
file object (e.g. if the :class:`LZMAFile` was constructed by passing a
118118
file object for *filename*).
119119

120+
.. attribute:: mode
121+
122+
``'rb'`` for reading and ``'wb'`` for writing.
123+
124+
.. versionadded:: 3.13
125+
126+
.. attribute:: name
127+
128+
The lzma file name. Equivalent to the :attr:`~io.FileIO.name`
129+
attribute of the underlying :term:`file object`.
130+
131+
.. versionadded:: 3.13
132+
133+
120134
.. versionchanged:: 3.4
121135
Added support for the ``"x"`` and ``"xb"`` modes.
122136

Doc/library/statistics.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,9 @@ However, for reading convenience, most of the examples show sorted sequences.
501501
variance indicates that the data is spread out; a small variance indicates
502502
it is clustered closely around the mean.
503503

504-
If the optional second argument *mu* is given, it is typically the mean of
505-
the *data*. It can also be used to compute the second moment around a
506-
point that is not the mean. If it is missing or ``None`` (the default),
504+
If the optional second argument *mu* is given, it should be the *population*
505+
mean of the *data*. It can also be used to compute the second moment around
506+
a point that is not the mean. If it is missing or ``None`` (the default),
507507
the arithmetic mean is automatically calculated.
508508

509509
Use this function to calculate the variance from the entire population. To
@@ -573,8 +573,8 @@ However, for reading convenience, most of the examples show sorted sequences.
573573
the data is spread out; a small variance indicates it is clustered closely
574574
around the mean.
575575

576-
If the optional second argument *xbar* is given, it should be the mean of
577-
*data*. If it is missing or ``None`` (the default), the mean is
576+
If the optional second argument *xbar* is given, it should be the *sample*
577+
mean of *data*. If it is missing or ``None`` (the default), the mean is
578578
automatically calculated.
579579

580580
Use this function when your data is a sample from a population. To calculate
@@ -590,8 +590,8 @@ However, for reading convenience, most of the examples show sorted sequences.
590590
>>> variance(data)
591591
1.3720238095238095
592592

593-
If you have already calculated the mean of your data, you can pass it as the
594-
optional second argument *xbar* to avoid recalculation:
593+
If you have already calculated the sample mean of your data, you can pass it
594+
as the optional second argument *xbar* to avoid recalculation:
595595

596596
.. doctest::
597597

Doc/library/stdtypes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5542,6 +5542,13 @@ types, where they are relevant. Some of these are not reported by the
55425542
[<class 'bool'>, <enum 'IntEnum'>, <flag 'IntFlag'>, <class 're._constants._NamedIntConstant'>]
55435543

55445544

5545+
.. attribute:: class.__static_attributes__
5546+
5547+
A tuple containing names of attributes of this class which are accessed
5548+
through ``self.X`` from any function in its body.
5549+
5550+
.. versionadded:: 3.13
5551+
55455552
.. _int_max_str_digits:
55465553

55475554
Integer string conversion length limitation

0 commit comments

Comments
 (0)