Skip to content

Commit d052f9d

Browse files
authored
Merge branch 'main' into opt-mod-loadattr-103951
2 parents f027429 + 3d4fda2 commit d052f9d

File tree

110 files changed

+2948
-691
lines changed

Some content is hidden

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

110 files changed

+2948
-691
lines changed

Doc/deprecations/pending-removal-in-3.14.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,6 @@ Pending removal in Python 3.14
103103
if :ref:`named placeholders <sqlite3-placeholders>` are used and
104104
*parameters* is a sequence instead of a :class:`dict`.
105105

106-
* date and datetime adapter, date and timestamp converter:
107-
see the :mod:`sqlite3` documentation for suggested replacement recipes.
108-
109-
* :class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was
110-
deprecated in :pep:`626`
111-
since 3.10 and was planned to be removed in 3.12,
112-
but it only got a proper :exc:`DeprecationWarning` in 3.12.
113-
May be removed in 3.14.
114-
(Contributed by Nikita Sobolev in :gh:`101866`.)
115-
116106
* :mod:`typing`: :class:`!typing.ByteString`, deprecated since Python 3.9,
117107
now causes a :exc:`DeprecationWarning` to be emitted when it is used.
118108

Doc/deprecations/pending-removal-in-3.15.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ Pending removal in Python 3.15
5959
but the C version allows any number of positional or keyword arguments,
6060
ignoring every argument.
6161

62+
* :mod:`types`:
63+
64+
* :class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was
65+
deprecated in :pep:`626`
66+
since 3.10 and was planned to be removed in 3.12,
67+
but it only got a proper :exc:`DeprecationWarning` in 3.12.
68+
May be removed in 3.15.
69+
(Contributed by Nikita Sobolev in :gh:`101866`.)
70+
6271
* :mod:`typing`:
6372

6473
* The undocumented keyword argument syntax for creating

Doc/library/asyncio-eventloop.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,8 @@ an event loop:
5959
instead of using these lower level functions to manually create and close an
6060
event loop.
6161

62-
.. deprecated:: 3.12
63-
Deprecation warning is emitted if there is no current event loop.
64-
In some future Python release this will become an error.
62+
.. versionchanged:: 3.14
63+
Raises a :exc:`RuntimeError` if there is no current event loop.
6564

6665
.. function:: set_event_loop(loop)
6766

Doc/library/asyncio-policy.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,9 @@ asyncio ships with the following built-in policies:
9797

9898
On Windows, :class:`ProactorEventLoop` is now used by default.
9999

100-
.. deprecated:: 3.12
101-
The :meth:`get_event_loop` method of the default asyncio policy now emits
102-
a :exc:`DeprecationWarning` if there is no current event loop set and it
103-
decides to create one.
104-
In some future Python release this will become an error.
100+
.. versionchanged:: 3.14
101+
The :meth:`get_event_loop` method of the default asyncio policy now
102+
raises a :exc:`RuntimeError` if there is no set event loop.
105103

106104

107105
.. class:: WindowsSelectorEventLoopPolicy

Doc/library/cmath.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,19 +221,21 @@ Classification functions
221221
``False`` otherwise.
222222

223223
Whether or not two values are considered close is determined according to
224-
given absolute and relative tolerances.
224+
given absolute and relative tolerances. If no errors occur, the result will
225+
be: ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``.
225226

226227
*rel_tol* is the relative tolerance -- it is the maximum allowed difference
227228
between *a* and *b*, relative to the larger absolute value of *a* or *b*.
228229
For example, to set a tolerance of 5%, pass ``rel_tol=0.05``. The default
229230
tolerance is ``1e-09``, which assures that the two values are the same
230-
within about 9 decimal digits. *rel_tol* must be greater than zero.
231-
232-
*abs_tol* is the minimum absolute tolerance -- useful for comparisons near
233-
zero. *abs_tol* must be at least zero.
234-
235-
If no errors occur, the result will be:
236-
``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``.
231+
within about 9 decimal digits. *rel_tol* must be nonnegative and less
232+
than ``1.0``.
233+
234+
*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be
235+
nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed
236+
as ``abs(x) <= rel_tol * abs(x)``, which is ``False`` for any ``x`` and
237+
rel_tol less than ``1.0``. So add an appropriate positive abs_tol argument
238+
to the call.
237239

238240
The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be
239241
handled according to IEEE rules. Specifically, ``NaN`` is not considered

Doc/library/configparser.rst

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,13 @@ interpolation if an option used is not defined elsewhere. ::
942942
ConfigParser Objects
943943
--------------------
944944

945-
.. class:: ConfigParser(defaults=None, dict_type=dict, allow_no_value=False, delimiters=('=', ':'), comment_prefixes=('#', ';'), inline_comment_prefixes=None, strict=True, empty_lines_in_values=True, default_section=configparser.DEFAULTSECT, interpolation=BasicInterpolation(), converters={})
945+
.. class:: ConfigParser(defaults=None, dict_type=dict, allow_no_value=False, *, \
946+
delimiters=('=', ':'), comment_prefixes=('#', ';'), \
947+
inline_comment_prefixes=None, strict=True, \
948+
empty_lines_in_values=True, \
949+
default_section=configparser.DEFAULTSECT, \
950+
interpolation=BasicInterpolation(), converters={}, \
951+
allow_unnamed_section=False)
946952

947953
The main configuration parser. When *defaults* is given, it is initialized
948954
into the dictionary of intrinsic defaults. When *dict_type* is given, it
@@ -990,6 +996,10 @@ ConfigParser Objects
990996
converter gets its own corresponding :meth:`!get*` method on the parser
991997
object and section proxies.
992998

999+
When *allow_unnamed_section* is ``True`` (default: ``False``),
1000+
the first section name can be omitted. See the
1001+
`"Unnamed Sections" section <#unnamed-sections>`_.
1002+
9931003
It is possible to read several configurations into a single
9941004
:class:`ConfigParser`, where the most recently added configuration has the
9951005
highest priority. Any conflicting keys are taken from the more recent
@@ -1039,6 +1049,9 @@ ConfigParser Objects
10391049
Raise a :exc:`MultilineContinuationError` when *allow_no_value* is
10401050
``True``, and a key without a value is continued with an indented line.
10411051

1052+
.. versionchanged:: 3.13
1053+
The *allow_unnamed_section* argument was added.
1054+
10421055
.. method:: defaults()
10431056

10441057
Return a dictionary containing the instance-wide defaults.
@@ -1295,18 +1308,30 @@ RawConfigParser Objects
12951308
comment_prefixes=('#', ';'), \
12961309
inline_comment_prefixes=None, strict=True, \
12971310
empty_lines_in_values=True, \
1298-
default_section=configparser.DEFAULTSECT[, \
1299-
interpolation])
1311+
default_section=configparser.DEFAULTSECT, \
1312+
interpolation=BasicInterpolation(), converters={}, \
1313+
allow_unnamed_section=False)
13001314
13011315
Legacy variant of the :class:`ConfigParser`. It has interpolation
13021316
disabled by default and allows for non-string section names, option
13031317
names, and values via its unsafe ``add_section`` and ``set`` methods,
13041318
as well as the legacy ``defaults=`` keyword argument handling.
13051319

1320+
.. versionchanged:: 3.2
1321+
*allow_no_value*, *delimiters*, *comment_prefixes*, *strict*,
1322+
*empty_lines_in_values*, *default_section* and *interpolation* were
1323+
added.
1324+
1325+
.. versionchanged:: 3.5
1326+
The *converters* argument was added.
1327+
13061328
.. versionchanged:: 3.8
13071329
The default *dict_type* is :class:`dict`, since it now preserves
13081330
insertion order.
13091331

1332+
.. versionchanged:: 3.13
1333+
The *allow_unnamed_section* argument was added.
1334+
13101335
.. note::
13111336
Consider using :class:`ConfigParser` instead which checks types of
13121337
the values to be stored internally. If you don't want interpolation, you

Doc/library/dis.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,7 @@ iterations of the loop.
15621562

15631563
.. opcode:: MAKE_FUNCTION
15641564

1565-
Pushes a new function object on the stack built from the code object at ``STACK[1]``.
1565+
Pushes a new function object on the stack built from the code object at ``STACK[-1]``.
15661566

15671567
.. versionchanged:: 3.10
15681568
Flag value ``0x04`` is a tuple of strings instead of dictionary

Doc/library/functions.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,14 +1205,19 @@ are always available. They are listed here in alphabetical order.
12051205
unchanged from previous versions.
12061206

12071207

1208-
.. function:: map(function, iterable, *iterables)
1208+
.. function:: map(function, iterable, /, *iterables, strict=False)
12091209

12101210
Return an iterator that applies *function* to every item of *iterable*,
12111211
yielding the results. If additional *iterables* arguments are passed,
12121212
*function* must take that many arguments and is applied to the items from all
12131213
iterables in parallel. With multiple iterables, the iterator stops when the
1214-
shortest iterable is exhausted. For cases where the function inputs are
1215-
already arranged into argument tuples, see :func:`itertools.starmap`\.
1214+
shortest iterable is exhausted. If *strict* is ``True`` and one of the
1215+
iterables is exhausted before the others, a :exc:`ValueError` is raised. For
1216+
cases where the function inputs are already arranged into argument tuples,
1217+
see :func:`itertools.starmap`.
1218+
1219+
.. versionchanged:: 3.14
1220+
Added the *strict* parameter.
12161221

12171222

12181223
.. function:: max(iterable, *, key=None)

Doc/library/getopt.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ exception:
9797

9898
An example using only Unix style options:
9999

100+
.. doctest::
101+
100102
>>> import getopt
101103
>>> args = '-a -b -cfoo -d bar a1 a2'.split()
102104
>>> args
@@ -109,6 +111,8 @@ An example using only Unix style options:
109111

110112
Using long option names is equally easy:
111113

114+
.. doctest::
115+
112116
>>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'
113117
>>> args = s.split()
114118
>>> args
@@ -120,7 +124,9 @@ Using long option names is equally easy:
120124
>>> args
121125
['a1', 'a2']
122126

123-
In a script, typical usage is something like this::
127+
In a script, typical usage is something like this:
128+
129+
.. testcode::
124130

125131
import getopt, sys
126132

@@ -150,7 +156,9 @@ In a script, typical usage is something like this::
150156
main()
151157

152158
Note that an equivalent command line interface could be produced with less code
153-
and more informative help and error messages by using the :mod:`argparse` module::
159+
and more informative help and error messages by using the :mod:`argparse` module:
160+
161+
.. testcode::
154162

155163
import argparse
156164

Doc/library/math.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,19 +244,21 @@ Number-theoretic and representation functions
244244
``False`` otherwise.
245245

246246
Whether or not two values are considered close is determined according to
247-
given absolute and relative tolerances.
247+
given absolute and relative tolerances. If no errors occur, the result will
248+
be: ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``.
248249

249250
*rel_tol* is the relative tolerance -- it is the maximum allowed difference
250251
between *a* and *b*, relative to the larger absolute value of *a* or *b*.
251252
For example, to set a tolerance of 5%, pass ``rel_tol=0.05``. The default
252253
tolerance is ``1e-09``, which assures that the two values are the same
253-
within about 9 decimal digits. *rel_tol* must be greater than zero.
254+
within about 9 decimal digits. *rel_tol* must be nonnegative and less
255+
than ``1.0``.
254256

255-
*abs_tol* is the minimum absolute tolerance -- useful for comparisons near
256-
zero. *abs_tol* must be at least zero.
257-
258-
If no errors occur, the result will be:
259-
``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``.
257+
*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be
258+
nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed
259+
as ``abs(x) <= rel_tol * abs(x)``, which is ``False`` for any ``x`` and
260+
rel_tol less than ``1.0``. So add an appropriate positive abs_tol argument
261+
to the call.
260262

261263
The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be
262264
handled according to IEEE rules. Specifically, ``NaN`` is not considered
@@ -404,7 +406,7 @@ Number-theoretic and representation functions
404406

405407
Roughly equivalent to::
406408

407-
sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))
409+
sum(map(operator.mul, p, q, strict=True))
408410

409411
For float and mixed int/float inputs, the intermediate products
410412
and sums are computed with extended precision.

0 commit comments

Comments
 (0)