Skip to content

Commit cdf5ad9

Browse files
authored
Merge branch '3.12' into backport-8a00c9a-3.12
2 parents 03583e7 + 0bfb3ba commit cdf5ad9

Some content is hidden

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

42 files changed

+932
-256
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ tags
3838
TAGS
3939
.vs/
4040
.vscode/
41+
.cache/
4142
gmon.out
4243
.coverage
4344
.mypy_cache/

Doc/faq/programming.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -986,8 +986,8 @@ There are various techniques.
986986
f()
987987

988988

989-
Is there an equivalent to Perl's chomp() for removing trailing newlines from strings?
990-
-------------------------------------------------------------------------------------
989+
Is there an equivalent to Perl's ``chomp()`` for removing trailing newlines from strings?
990+
-----------------------------------------------------------------------------------------
991991

992992
You can use ``S.rstrip("\r\n")`` to remove all occurrences of any line
993993
terminator from the end of the string ``S`` without removing other trailing
@@ -1005,8 +1005,8 @@ Since this is typically only desired when reading text one line at a time, using
10051005
``S.rstrip()`` this way works well.
10061006

10071007

1008-
Is there a scanf() or sscanf() equivalent?
1009-
------------------------------------------
1008+
Is there a ``scanf()`` or ``sscanf()`` equivalent?
1009+
--------------------------------------------------
10101010

10111011
Not as such.
10121012

@@ -1020,8 +1020,8 @@ For more complicated input parsing, regular expressions are more powerful
10201020
than C's ``sscanf`` and better suited for the task.
10211021

10221022

1023-
What does 'UnicodeDecodeError' or 'UnicodeEncodeError' error mean?
1024-
-------------------------------------------------------------------
1023+
What does ``UnicodeDecodeError`` or ``UnicodeEncodeError`` error mean?
1024+
----------------------------------------------------------------------
10251025

10261026
See the :ref:`unicode-howto`.
10271027

@@ -1036,7 +1036,7 @@ A raw string ending with an odd number of backslashes will escape the string's q
10361036
>>> r'C:\this\will\not\work\'
10371037
File "<stdin>", line 1
10381038
r'C:\this\will\not\work\'
1039-
^
1039+
^
10401040
SyntaxError: unterminated string literal (detected at line 1)
10411041

10421042
There are several workarounds for this. One is to use regular strings and double
@@ -1868,15 +1868,15 @@ object identity is assured. Generally, there are three circumstances where
18681868
identity is guaranteed:
18691869

18701870
1) Assignments create new names but do not change object identity. After the
1871-
assignment ``new = old``, it is guaranteed that ``new is old``.
1871+
assignment ``new = old``, it is guaranteed that ``new is old``.
18721872

18731873
2) Putting an object in a container that stores object references does not
1874-
change object identity. After the list assignment ``s[0] = x``, it is
1875-
guaranteed that ``s[0] is x``.
1874+
change object identity. After the list assignment ``s[0] = x``, it is
1875+
guaranteed that ``s[0] is x``.
18761876

18771877
3) If an object is a singleton, it means that only one instance of that object
1878-
can exist. After the assignments ``a = None`` and ``b = None``, it is
1879-
guaranteed that ``a is b`` because ``None`` is a singleton.
1878+
can exist. After the assignments ``a = None`` and ``b = None``, it is
1879+
guaranteed that ``a is b`` because ``None`` is a singleton.
18801880

18811881
In most other circumstances, identity tests are inadvisable and equality tests
18821882
are preferred. In particular, identity tests should not be used to check

Doc/library/cmath.rst

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ segment that joins the origin to *z*.
5555
The following functions can be used to convert from the native
5656
rectangular coordinates to polar coordinates and back.
5757

58-
.. function:: phase(x)
58+
.. function:: phase(z)
5959

60-
Return the phase of *x* (also known as the *argument* of *x*), as a float.
61-
``phase(x)`` is equivalent to ``math.atan2(x.imag, x.real)``. The result
60+
Return the phase of *z* (also known as the *argument* of *z*), as a float.
61+
``phase(z)`` is equivalent to ``math.atan2(z.imag, z.real)``. The result
6262
lies in the range [-\ *π*, *π*], and the branch cut for this operation lies
6363
along the negative real axis. The sign of the result is the same as the
64-
sign of ``x.imag``, even when ``x.imag`` is zero::
64+
sign of ``z.imag``, even when ``z.imag`` is zero::
6565

6666
>>> phase(complex(-1.0, 0.0))
6767
3.141592653589793
@@ -71,147 +71,147 @@ rectangular coordinates to polar coordinates and back.
7171

7272
.. note::
7373

74-
The modulus (absolute value) of a complex number *x* can be
74+
The modulus (absolute value) of a complex number *z* can be
7575
computed using the built-in :func:`abs` function. There is no
7676
separate :mod:`cmath` module function for this operation.
7777

7878

79-
.. function:: polar(x)
79+
.. function:: polar(z)
8080

81-
Return the representation of *x* in polar coordinates. Returns a
82-
pair ``(r, phi)`` where *r* is the modulus of *x* and phi is the
83-
phase of *x*. ``polar(x)`` is equivalent to ``(abs(x),
84-
phase(x))``.
81+
Return the representation of *z* in polar coordinates. Returns a
82+
pair ``(r, phi)`` where *r* is the modulus of *z* and *phi* is the
83+
phase of *z*. ``polar(z)`` is equivalent to ``(abs(z),
84+
phase(z))``.
8585

8686

8787
.. function:: rect(r, phi)
8888

89-
Return the complex number *x* with polar coordinates *r* and *phi*.
89+
Return the complex number *z* with polar coordinates *r* and *phi*.
9090
Equivalent to ``complex(r * math.cos(phi), r * math.sin(phi))``.
9191

9292

9393
Power and logarithmic functions
9494
-------------------------------
9595

96-
.. function:: exp(x)
96+
.. function:: exp(z)
9797

98-
Return *e* raised to the power *x*, where *e* is the base of natural
98+
Return *e* raised to the power *z*, where *e* is the base of natural
9999
logarithms.
100100

101101

102-
.. function:: log(x[, base])
102+
.. function:: log(z[, base])
103103

104-
Returns the logarithm of *x* to the given *base*. If the *base* is not
105-
specified, returns the natural logarithm of *x*. There is one branch cut,
104+
Return the logarithm of *z* to the given *base*. If the *base* is not
105+
specified, returns the natural logarithm of *z*. There is one branch cut,
106106
from 0 along the negative real axis to -∞.
107107

108108

109-
.. function:: log10(x)
109+
.. function:: log10(z)
110110

111-
Return the base-10 logarithm of *x*. This has the same branch cut as
111+
Return the base-10 logarithm of *z*. This has the same branch cut as
112112
:func:`log`.
113113

114114

115-
.. function:: sqrt(x)
115+
.. function:: sqrt(z)
116116

117-
Return the square root of *x*. This has the same branch cut as :func:`log`.
117+
Return the square root of *z*. This has the same branch cut as :func:`log`.
118118

119119

120120
Trigonometric functions
121121
-----------------------
122122

123-
.. function:: acos(x)
123+
.. function:: acos(z)
124124

125-
Return the arc cosine of *x*. There are two branch cuts: One extends right
125+
Return the arc cosine of *z*. There are two branch cuts: One extends right
126126
from 1 along the real axis to ∞. The other extends left from -1 along the
127127
real axis to -∞.
128128

129129

130-
.. function:: asin(x)
130+
.. function:: asin(z)
131131

132-
Return the arc sine of *x*. This has the same branch cuts as :func:`acos`.
132+
Return the arc sine of *z*. This has the same branch cuts as :func:`acos`.
133133

134134

135-
.. function:: atan(x)
135+
.. function:: atan(z)
136136

137-
Return the arc tangent of *x*. There are two branch cuts: One extends from
137+
Return the arc tangent of *z*. There are two branch cuts: One extends from
138138
``1j`` along the imaginary axis to ``∞j``. The other extends from ``-1j``
139139
along the imaginary axis to ``-∞j``.
140140

141141

142-
.. function:: cos(x)
142+
.. function:: cos(z)
143143

144-
Return the cosine of *x*.
144+
Return the cosine of *z*.
145145

146146

147-
.. function:: sin(x)
147+
.. function:: sin(z)
148148

149-
Return the sine of *x*.
149+
Return the sine of *z*.
150150

151151

152-
.. function:: tan(x)
152+
.. function:: tan(z)
153153

154-
Return the tangent of *x*.
154+
Return the tangent of *z*.
155155

156156

157157
Hyperbolic functions
158158
--------------------
159159

160-
.. function:: acosh(x)
160+
.. function:: acosh(z)
161161

162-
Return the inverse hyperbolic cosine of *x*. There is one branch cut,
162+
Return the inverse hyperbolic cosine of *z*. There is one branch cut,
163163
extending left from 1 along the real axis to -∞.
164164

165165

166-
.. function:: asinh(x)
166+
.. function:: asinh(z)
167167

168-
Return the inverse hyperbolic sine of *x*. There are two branch cuts:
168+
Return the inverse hyperbolic sine of *z*. There are two branch cuts:
169169
One extends from ``1j`` along the imaginary axis to ``∞j``. The other
170170
extends from ``-1j`` along the imaginary axis to ``-∞j``.
171171

172172

173-
.. function:: atanh(x)
173+
.. function:: atanh(z)
174174

175-
Return the inverse hyperbolic tangent of *x*. There are two branch cuts: One
175+
Return the inverse hyperbolic tangent of *z*. There are two branch cuts: One
176176
extends from ``1`` along the real axis to ````. The other extends from
177177
``-1`` along the real axis to ``-∞``.
178178

179179

180-
.. function:: cosh(x)
180+
.. function:: cosh(z)
181181

182-
Return the hyperbolic cosine of *x*.
182+
Return the hyperbolic cosine of *z*.
183183

184184

185-
.. function:: sinh(x)
185+
.. function:: sinh(z)
186186

187-
Return the hyperbolic sine of *x*.
187+
Return the hyperbolic sine of *z*.
188188

189189

190-
.. function:: tanh(x)
190+
.. function:: tanh(z)
191191

192-
Return the hyperbolic tangent of *x*.
192+
Return the hyperbolic tangent of *z*.
193193

194194

195195
Classification functions
196196
------------------------
197197

198-
.. function:: isfinite(x)
198+
.. function:: isfinite(z)
199199

200-
Return ``True`` if both the real and imaginary parts of *x* are finite, and
200+
Return ``True`` if both the real and imaginary parts of *z* are finite, and
201201
``False`` otherwise.
202202

203203
.. versionadded:: 3.2
204204

205205

206-
.. function:: isinf(x)
206+
.. function:: isinf(z)
207207

208-
Return ``True`` if either the real or the imaginary part of *x* is an
208+
Return ``True`` if either the real or the imaginary part of *z* is an
209209
infinity, and ``False`` otherwise.
210210

211211

212-
.. function:: isnan(x)
212+
.. function:: isnan(z)
213213

214-
Return ``True`` if either the real or the imaginary part of *x* is a NaN,
214+
Return ``True`` if either the real or the imaginary part of *z* is a NaN,
215215
and ``False`` otherwise.
216216

217217

Doc/library/plistlib.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ This module defines the following functions:
7474
exceptions on ill-formed XML. Unknown elements will simply be ignored
7575
by the plist parser.
7676

77-
The parser for the binary format raises :exc:`InvalidFileException`
78-
when the file cannot be parsed.
77+
The parser raises :exc:`InvalidFileException` when the file cannot be parsed.
7978

8079
.. versionadded:: 3.4
8180

@@ -154,6 +153,15 @@ The following constants are available:
154153
.. versionadded:: 3.4
155154

156155

156+
The module defines the following exceptions:
157+
158+
.. exception:: InvalidFileException
159+
160+
Raised when a file cannot be parsed.
161+
162+
.. versionadded:: 3.4
163+
164+
157165
Examples
158166
--------
159167

Doc/library/socket.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -833,10 +833,10 @@ The following functions all create :ref:`socket objects <socket-objects>`.
833833
, a default reasonable value is chosen.
834834
*reuse_port* dictates whether to set the :data:`SO_REUSEPORT` socket option.
835835

836-
If *dualstack_ipv6* is true and the platform supports it the socket will
837-
be able to accept both IPv4 and IPv6 connections, else it will raise
838-
:exc:`ValueError`. Most POSIX platforms and Windows are supposed to support
839-
this functionality.
836+
If *dualstack_ipv6* is true, *family* is :data:`AF_INET6` and the platform
837+
supports it the socket will be able to accept both IPv4 and IPv6 connections,
838+
else it will raise :exc:`ValueError`. Most POSIX platforms and Windows are
839+
supposed to support this functionality.
840840
When this functionality is enabled the address returned by
841841
:meth:`socket.getpeername` when an IPv4 connection occurs will be an IPv6
842842
address represented as an IPv4-mapped IPv6 address.

Doc/library/stdtypes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4577,7 +4577,7 @@ can be used interchangeably to index the same dictionary entry.
45774577
such as an empty list. To get distinct values, use a :ref:`dict
45784578
comprehension <dict>` instead.
45794579

4580-
.. method:: get(key, default=None)
4580+
.. method:: get(key, default=None, /)
45814581

45824582
Return the value for *key* if *key* is in the dictionary, else *default*.
45834583
If *default* is not given, it defaults to ``None``, so that this method
@@ -4619,7 +4619,7 @@ can be used interchangeably to index the same dictionary entry.
46194619

46204620
.. versionadded:: 3.8
46214621

4622-
.. method:: setdefault(key, default=None)
4622+
.. method:: setdefault(key, default=None, /)
46234623

46244624
If *key* is in the dictionary, return its value. If not, insert *key*
46254625
with a value of *default* and return *default*. *default* defaults to

Lib/http/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ def run_cgi(self):
10981098
"CGI script is not executable (%r)" % scriptname)
10991099
return
11001100

1101-
# Reference: http://hoohoo.ncsa.uiuc.edu/cgi/env.html
1101+
# Reference: https://www6.uniovi.es/~antonio/ncsa_httpd/cgi/env.html
11021102
# XXX Much of the following could be prepared ahead of time!
11031103
env = copy.deepcopy(os.environ)
11041104
env['SERVER_SOFTWARE'] = self.version_string()

0 commit comments

Comments
 (0)