Skip to content

Commit bc4ba0c

Browse files
committed
Merge branch 'master' into import-refcounts
2 parents c8daad6 + ee9f98d commit bc4ba0c

File tree

163 files changed

+6529
-4253
lines changed

Some content is hidden

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

163 files changed

+6529
-4253
lines changed

Doc/copyright.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Copyright
44

55
Python and this documentation is:
66

7-
Copyright © 2001-2020 Python Software Foundation. All rights reserved.
7+
Copyright © 2001-2021 Python Software Foundation. All rights reserved.
88

99
Copyright © 2000 BeOpen.com. All rights reserved.
1010

Doc/library/curses.rst

+8-6
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,15 @@ The module :mod:`curses` defines the following functions:
112112
.. function:: color_content(color_number)
113113

114114
Return the intensity of the red, green, and blue (RGB) components in the color
115-
*color_number*, which must be between ``0`` and :const:`COLORS`. Return a 3-tuple,
115+
*color_number*, which must be between ``0`` and ``COLORS - 1``. Return a 3-tuple,
116116
containing the R,G,B values for the given color, which will be between
117117
``0`` (no component) and ``1000`` (maximum amount of component).
118118

119119

120-
.. function:: color_pair(color_number)
120+
.. function:: color_pair(pair_number)
121121

122-
Return the attribute value for displaying text in the specified color. This
122+
Return the attribute value for displaying text in the specified color pair.
123+
Only the first 256 color pairs are supported. This
123124
attribute value can be combined with :const:`A_STANDOUT`, :const:`A_REVERSE`,
124125
and the other :const:`A_\*` attributes. :func:`pair_number` is the counterpart
125126
to this function.
@@ -287,7 +288,7 @@ The module :mod:`curses` defines the following functions:
287288
Change the definition of a color, taking the number of the color to be changed
288289
followed by three RGB values (for the amounts of red, green, and blue
289290
components). The value of *color_number* must be between ``0`` and
290-
:const:`COLORS`. Each of *r*, *g*, *b*, must be a value between ``0`` and
291+
`COLORS - 1`. Each of *r*, *g*, *b*, must be a value between ``0`` and
291292
``1000``. When :func:`init_color` is used, all occurrences of that color on the
292293
screen immediately change to the new definition. This function is a no-op on
293294
most terminals; it is active only if :func:`can_change_color` returns ``True``.
@@ -300,7 +301,8 @@ The module :mod:`curses` defines the following functions:
300301
color number. The value of *pair_number* must be between ``1`` and
301302
``COLOR_PAIRS - 1`` (the ``0`` color pair is wired to white on black and cannot
302303
be changed). The value of *fg* and *bg* arguments must be between ``0`` and
303-
:const:`COLORS`. If the color-pair was previously initialized, the screen is
304+
``COLORS - 1``, or, after calling :func:`use_default_colors`, ``-1``.
305+
If the color-pair was previously initialized, the screen is
304306
refreshed and all occurrences of that color-pair are changed to the new
305307
definition.
306308

@@ -450,7 +452,7 @@ The module :mod:`curses` defines the following functions:
450452
.. function:: pair_content(pair_number)
451453

452454
Return a tuple ``(fg, bg)`` containing the colors for the requested color pair.
453-
The value of *pair_number* must be between ``1`` and ``COLOR_PAIRS - 1``.
455+
The value of *pair_number* must be between ``0`` and ``COLOR_PAIRS - 1``.
454456

455457

456458
.. function:: pair_number(attr)

Doc/library/functools.rst

+14-4
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,26 @@ The :mod:`functools` module defines the following functions:
6262
Example::
6363

6464
class DataSet:
65+
6566
def __init__(self, sequence_of_numbers):
66-
self._data = sequence_of_numbers
67+
self._data = tuple(sequence_of_numbers)
6768

6869
@cached_property
6970
def stdev(self):
7071
return statistics.stdev(self._data)
7172

72-
@cached_property
73-
def variance(self):
74-
return statistics.variance(self._data)
73+
The mechanics of :func:`cached_property` are somewhat different from
74+
:func:`property`. A regular property blocks attribute writes unless a
75+
setter is defined. In contrast, a *cached_property* allows writes.
76+
77+
The *cached_property* decorator only runs on lookups and only when an
78+
attribute of the same name doesn't exist. When it does run, the
79+
*cached_property* writes to the attribute with the same name. Subsequent
80+
attribute reads and writes take precedence over the *cached_property*
81+
method and it works like a normal attribute.
82+
83+
The cached value can be cleared by deleting the attribute. This
84+
allows the *cached_property* method to run again.
7585

7686
Note, this decorator interferes with the operation of :pep:`412`
7787
key-sharing dictionaries. This means that instance dictionaries

Doc/library/importlib.metadata.rst

+5-10
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,9 @@ Every distribution includes some metadata, which you can extract using the
115115

116116
>>> wheel_metadata = metadata('wheel') # doctest: +SKIP
117117

118-
The keys of the returned data structure [#f1]_ name the metadata keywords, and
119-
their values are returned unparsed from the distribution metadata::
118+
The keys of the returned data structure, a ``PackageMetadata``,
119+
name the metadata keywords, and
120+
the values are returned unparsed from the distribution metadata::
120121

121122
>>> wheel_metadata['Requires-Python'] # doctest: +SKIP
122123
'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'
@@ -206,9 +207,9 @@ Thus, an alternative way to get the version number is through the
206207
There are all kinds of additional metadata available on the ``Distribution``
207208
instance::
208209

209-
>>> d.metadata['Requires-Python'] # doctest: +SKIP
210+
>>> dist.metadata['Requires-Python'] # doctest: +SKIP
210211
'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'
211-
>>> d.metadata['License'] # doctest: +SKIP
212+
>>> dist.metadata['License'] # doctest: +SKIP
212213
'MIT'
213214

214215
The full set of available metadata is not described here. See :pep:`566`
@@ -259,9 +260,3 @@ a custom finder, return instances of this derived ``Distribution`` in the
259260

260261

261262
.. rubric:: Footnotes
262-
263-
.. [#f1] Technically, the returned distribution metadata object is an
264-
:class:`email.message.EmailMessage`
265-
instance, but this is an implementation detail, and not part of the
266-
stable API. You should only use dictionary-like methods and syntax
267-
to access the metadata contents.

Doc/library/socket.rst

+6-10
Original file line numberDiff line numberDiff line change
@@ -907,11 +907,9 @@ The :mod:`socket` module also offers various network-related services:
907907
where the host byte order is the same as network byte order, this is a no-op;
908908
otherwise, it performs a 2-byte swap operation.
909909

910-
.. deprecated:: 3.7
911-
In case *x* does not fit in 16-bit unsigned integer, but does fit in a
912-
positive C int, it is silently truncated to 16-bit unsigned integer.
913-
This silent truncation feature is deprecated, and will raise an
914-
exception in future versions of Python.
910+
.. versionchanged:: 3.10
911+
Raises :exc:`OverflowError` if *x* does not fit in a 16-bit unsigned
912+
integer.
915913

916914

917915
.. function:: htonl(x)
@@ -927,11 +925,9 @@ The :mod:`socket` module also offers various network-related services:
927925
where the host byte order is the same as network byte order, this is a no-op;
928926
otherwise, it performs a 2-byte swap operation.
929927

930-
.. deprecated:: 3.7
931-
In case *x* does not fit in 16-bit unsigned integer, but does fit in a
932-
positive C int, it is silently truncated to 16-bit unsigned integer.
933-
This silent truncation feature is deprecated, and will raise an
934-
exception in future versions of Python.
928+
.. versionchanged:: 3.10
929+
Raises :exc:`OverflowError` if *x* does not fit in a 16-bit unsigned
930+
integer.
935931

936932

937933
.. function:: inet_aton(ip_string)

Doc/library/statistics.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ However, for reading convenience, most of the examples show sorted sequences.
198198

199199
.. versionadded:: 3.6
200200

201-
.. versionchanged:: 3.8
201+
.. versionchanged:: 3.10
202202
Added support for *weights*.
203203

204204
.. function:: median(data)

Doc/library/stdtypes.rst

+5
Original file line numberDiff line numberDiff line change
@@ -4959,6 +4959,11 @@ All parameterized generics implement special read-only attributes.
49594959
(~T,)
49604960

49614961

4962+
.. note::
4963+
A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not
4964+
have correct ``__parameters__`` after substitution because
4965+
:class:`typing.ParamSpec` is intended primarily for static type checking.
4966+
49624967
.. seealso::
49634968

49644969
* :pep:`585` -- "Type Hinting Generics In Standard Collections"

0 commit comments

Comments
 (0)