Skip to content

Commit 386719a

Browse files
authored
Merge branch 'main' into complex-abs-errno/155526
2 parents 8c982dd + 69a6612 commit 386719a

27 files changed

Lines changed: 415 additions & 93 deletions

Doc/howto/logging-cookbook.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3920,7 +3920,7 @@ subclassed handler which looks something like this::
39203920

39213921
You'll need to be familiar with RFC 5424 to fully understand the above code, and it
39223922
may be that you have slightly different needs (e.g. for how you pass structural data
3923-
to the log). Nevertheless, the above should be adaptable to your speciric needs. With
3923+
to the log). Nevertheless, the above should be adaptable to your specific needs. With
39243924
the above handler, you'd pass structured data using something like this::
39253925

39263926
sd = {

Doc/howto/mro.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ prescription:
189189
the tail of any of the other lists, then add it to the linearization
190190
of C and remove it from the lists in the merge, otherwise look at the
191191
head of the next list and take it, if it is a good head. Then repeat
192-
the operation until all the class are removed or it is impossible to
192+
the operation until all the classes are removed or it is impossible to
193193
find good heads. In this case, it is impossible to construct the
194194
merge, Python 2.3 will refuse to create the class C and will raise an
195195
exception.*

Doc/library/curses.rst

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,10 @@ Input options
326326

327327
The curses library does "line-breakout optimization" by looking for typeahead
328328
periodically while updating the screen. If input is found, and it is coming
329-
from a tty, the current update is postponed until refresh or doupdate is called
330-
again, allowing faster response to commands typed in advance. This function
331-
allows specifying a different file descriptor for typeahead checking.
329+
from a tty, the current update is postponed until :meth:`~window.refresh` or
330+
:func:`doupdate` is called again, allowing faster response to commands typed
331+
in advance. This function allows specifying a different file descriptor for
332+
typeahead checking.
332333

333334
.. function:: is_cbreak()
334335

@@ -702,7 +703,8 @@ labels.
702703
(eight labels). Where the underlying curses library supports them, ``2``
703704
gives 4-4-4 (twelve labels) and ``3`` gives 4-4-4 with an index line.
704705

705-
Must be called before :func:`initscr` or :func:`newterm`.
706+
Must be called before :func:`initscr` or :func:`newterm`,
707+
and affects only the screen created next.
706708

707709
.. versionadded:: next
708710

@@ -1067,8 +1069,10 @@ Utilities
10671069

10681070
.. function:: filter()
10691071

1070-
The :func:`.filter` routine, if used, must be called before :func:`initscr` is
1071-
called. The effect is that, during the initialization, :envvar:`LINES` is set to ``1``; the
1072+
The :func:`.filter` routine, if used, must be called before :func:`initscr`
1073+
or :func:`newterm` is called,
1074+
and affects every screen created afterwards.
1075+
The effect is that, during the initialization, :envvar:`LINES` is set to ``1``; the
10721076
capabilities ``clear``, ``cup``, ``cud``, ``cud1``, ``cuu1``, ``cuu``, ``vpa`` are disabled; and the ``home``
10731077
string is set to the value of ``cr``. The effect is that the cursor is confined to
10741078
the current line, and so are screen updates. This may be used for enabling
@@ -1087,8 +1091,10 @@ Utilities
10871091

10881092
.. function:: use_env(flag)
10891093

1090-
If used, this function should be called before :func:`initscr` or newterm are
1091-
called. When *flag* is ``False``, the values of lines and columns specified in the
1094+
If used, this function should be called before :func:`initscr` or
1095+
:func:`newterm` are called,
1096+
and affects every screen created afterwards.
1097+
When *flag* is ``False``, the values of lines and columns specified in the
10921098
terminfo database will be used, even if environment variables :envvar:`LINES`
10931099
and :envvar:`COLUMNS` (used by default) are set, or if curses is running in a
10941100
window (in which case default behavior would be to use the window size if
@@ -1106,6 +1112,9 @@ Utilities
11061112
to distinguish between an individual escape character entered on the
11071113
keyboard from escape sequences sent by cursor and function keys.
11081114

1115+
Depending on the curses library, the setting may apply to all screens,
1116+
not only to the current one.
1117+
11091118
.. versionadded:: 3.9
11101119

11111120
.. function:: get_tabsize()
@@ -1119,6 +1128,9 @@ Utilities
11191128
Sets the number of columns used by the curses library when converting a tab
11201129
character to spaces as it adds the tab to a window.
11211130

1131+
Depending on the curses library, the setting may apply to all screens,
1132+
not only to the current one, and creating a screen may reset it.
1133+
11221134
.. versionadded:: 3.9
11231135

11241136
.. function:: napms(ms)

Doc/library/logging.config.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ following configuration::
555555
'bar' : 'baz',
556556
'spam' : 99.9,
557557
'answer' : 42,
558-
'.' {
558+
'.' : {
559559
'foo': 'bar',
560560
'baz': 'bozz'
561561
}

Doc/library/pdb.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ can be overridden by the local file.
834834
def inner(x):
835835
1 / x
836836

837-
out()
837+
out()
838838

839839
calling ``pdb.pm()`` will allow to move between exceptions::
840840

Doc/reference/datamodel.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -798,12 +798,12 @@ Generator functions
798798
single: generator; function
799799
single: generator; iterator
800800

801-
A function or method which uses the :keyword:`yield` statement (see section
802-
:ref:`yield`) is called a :dfn:`generator function`. Such a function, when
801+
A function or method which contains a :keyword:`yield` expression (see section
802+
:ref:`yieldexpr`) is called a :dfn:`generator function`. Such a function, when
803803
called, always returns an :term:`iterator` object which can be used to
804804
execute the body of the function: calling the iterator's
805805
:meth:`iterator.__next__` method will cause the function to execute until
806-
it provides a value using the :keyword:`!yield` statement. When the
806+
it provides a value using the :keyword:`!yield` expression. When the
807807
function executes a :keyword:`return` statement or falls off the end, a
808808
:exc:`StopIteration` exception is raised and the iterator will have
809809
reached the end of the set of values to be returned.
@@ -830,7 +830,7 @@ Asynchronous generator functions
830830
single: asynchronous generator; asynchronous iterator
831831

832832
A function or method which is defined using :keyword:`async def` and
833-
which uses the :keyword:`yield` statement is called a
833+
which contains a :keyword:`yield` expression is called a
834834
:dfn:`asynchronous generator function`. Such a function, when called,
835835
returns an :term:`asynchronous iterator` object which can be used in an
836836
:keyword:`async for` statement to execute the body of the function.

Doc/whatsnew/3.16.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,9 @@ io
412412
ipaddress
413413
---------
414414

415-
* Add :meth:`~ipaddress.IPv4Network.next_network` and
416-
:meth:`~ipaddress.IPv6Network.next_network` methods to find the next nearest
417-
network with a specific prefix size.
415+
* Add :meth:`IPv4Network.next_network() <ipaddress.IPv4Network.next_network>`
416+
and :meth:`IPv6Network.next_network() <ipaddress.IPv6Network.next_network>`
417+
methods to find the next nearest network with a specific prefix size.
418418
(Contributed by Faisal Mahmood in :gh:`87027`.)
419419

420420

Lib/annotationlib.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,27 @@ def evaluate(
191191

192192
arg = self.__forward_arg__
193193
if arg.isidentifier() and not keyword.iskeyword(arg):
194+
resolved = _sentinel
194195
if arg in locals:
195-
return locals[arg]
196+
resolved = locals[arg]
196197
elif arg in globals:
197-
return globals[arg]
198+
resolved = globals[arg]
198199
elif hasattr(builtins, arg):
199-
return getattr(builtins, arg)
200+
resolved = getattr(builtins, arg)
201+
202+
if resolved is not _sentinel:
203+
if isinstance(resolved, types.LazyImportType):
204+
# We try reifying the lazy object. If this fails, we propagate
205+
# the error in the VALUE format and leave the
206+
# ForwardRef unresolved in the FORWARDREF format.
207+
try:
208+
return resolved.resolve()
209+
except Exception:
210+
if not is_forwardref_format:
211+
raise
212+
return self
213+
else:
214+
return resolved
200215
elif is_forwardref_format:
201216
return self
202217
else:

Lib/ipaddress.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,11 +1124,15 @@ def next_network(self, next_prefix=None):
11241124
11251125
Args:
11261126
next_prefix: The desired next prefix length, if not specified the
1127-
same self.prefixlen will be used
1127+
same self.prefixlen will be used.
11281128
11291129
Returns:
11301130
An IPv(4|6) Network object of the next closest network.
11311131
1132+
Raises:
1133+
ValueError: If next_prefix is outside the range of valid prefix
1134+
lengths, or if no further network of that size exists.
1135+
11321136
"""
11331137
if next_prefix is None:
11341138
next_prefix = self.prefixlen
@@ -1150,15 +1154,13 @@ def next_network(self, next_prefix=None):
11501154
((new_netmask._ip & self.network_address._ip) >> bit_shift) + 1
11511155
) << bit_shift
11521156

1153-
try:
1154-
return self.__class__(
1155-
f"{self._string_from_ip_int(next_ip)}/{next_prefix}"
1156-
)
1157-
except OverflowError:
1157+
if next_ip > self._ALL_ONES:
11581158
raise ValueError(
11591159
f"out of address space, cannot make another /{next_prefix} "
11601160
"network"
1161-
) from None
1161+
)
1162+
1163+
return self.__class__((next_ip, next_prefix))
11621164

11631165

11641166
class _BaseConstants:

Lib/test/mathdata/math_testcases.txt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,9 +1311,9 @@ atan2pi20000 atan2pi inf 0 -> 0.5
13111311
atan2pi20001 atan2pi -inf 0 -> -0.5
13121312
atan2pi20002 atan2pi nan 0 -> nan
13131313

1314-
atan2pi20000 atan2pi inf -0 -> 0.5
1315-
atan2pi20001 atan2pi -inf -0 -> -0.5
1316-
atan2pi20002 atan2pi nan -0 -> nan
1314+
atan2pi21000 atan2pi inf -0 -> 0.5
1315+
atan2pi21001 atan2pi -inf -0 -> -0.5
1316+
atan2pi21002 atan2pi nan -0 -> nan
13171317

13181318
atan2pi20003 atan2pi inf 1 -> 0.5
13191319
atan2pi20004 atan2pi -inf 1 -> -0.5
@@ -1339,9 +1339,9 @@ atan2pi30000 atan2pi 0 inf -> 0.0
13391339
atan2pi30001 atan2pi 0 -inf -> 1.0
13401340
atan2pi30002 atan2pi 0 nan -> nan
13411341

1342-
atan2pi30000 atan2pi -0 inf -> -0.0
1343-
atan2pi30001 atan2pi -0 -inf -> -1.0
1344-
atan2pi30002 atan2pi -0 nan -> nan
1342+
atan2pi31000 atan2pi -0 inf -> -0.0
1343+
atan2pi31001 atan2pi -0 -inf -> -1.0
1344+
atan2pi31002 atan2pi -0 nan -> nan
13451345

13461346
atan2pi30003 atan2pi 1 inf -> 0.0
13471347
atan2pi30004 atan2pi 1 -inf -> 1.0
@@ -2247,3 +2247,8 @@ tanpi10275 tanpi -1.6591963470121216 -> 1.829921944286168
22472247
tanpi20001 tanpi inf -> nan invalid
22482248
tanpi20002 tanpi -inf -> nan invalid
22492249
tanpi20003 tanpi nan -> nan
2250+
2251+
tanpi30001 tanpi 0.5 -> inf divide-by-zero
2252+
tanpi30002 tanpi -0.5 -> -inf divide-by-zero
2253+
tanpi30003 tanpi 1.5 -> -inf divide-by-zero
2254+
tanpi30004 tanpi -1.5 -> inf divide-by-zero

0 commit comments

Comments
 (0)