Skip to content

Commit 13116fd

Browse files
committed
Merge branch 'main' into intern-dataclass-field-names
2 parents eff115a + 42351c3 commit 13116fd

File tree

177 files changed

+2798
-709
lines changed

Some content is hidden

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

177 files changed

+2798
-709
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
# Build system
1515
configure* @erlend-aasland @corona10
16+
Makefile.pre.in @erlend-aasland
17+
Modules/Setup* @erlend-aasland
1618

1719
# asyncio
1820
**/*asyncio* @1st1 @asvetlov @gvanrossum @kumaraditya303 @willingc
@@ -245,7 +247,7 @@ Doc/howto/clinic.rst @erlend-aasland
245247
**/*interpreteridobject.* @ericsnowcurrently
246248
**/*crossinterp* @ericsnowcurrently
247249
Lib/test/support/interpreters/ @ericsnowcurrently
248-
Modules/_xx*interp*module.c @ericsnowcurrently
250+
Modules/_interp*module.c @ericsnowcurrently
249251
Lib/test/test_interpreters/ @ericsnowcurrently
250252

251253
# Android

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
# into the PR branch anyway.
5555
#
5656
# https://github.com/python/core-workflow/issues/373
57-
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc|^\.pre-commit-config\.yaml$|\.ruff\.toml$)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
57+
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc|^\.pre-commit-config\.yaml$|\.ruff\.toml$|\.md$|mypy\.ini$)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
5858
fi
5959
6060
# Check if we should run hypothesis tests

Doc/howto/descriptor.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ Invocation from super
787787
---------------------
788788

789789
The logic for super's dotted lookup is in the :meth:`__getattribute__` method for
790-
object returned by :class:`super()`.
790+
object returned by :func:`super`.
791791

792792
A dotted lookup such as ``super(A, obj).m`` searches ``obj.__class__.__mro__``
793793
for the base class ``B`` immediately following ``A`` and then returns

Doc/library/collections.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ The class can be used to simulate nested scopes and is useful in templating.
9999
:func:`super` function. A reference to ``d.parents`` is equivalent to:
100100
``ChainMap(*d.maps[1:])``.
101101

102-
Note, the iteration order of a :class:`ChainMap()` is determined by
102+
Note, the iteration order of a :class:`ChainMap` is determined by
103103
scanning the mappings last to first::
104104

105105
>>> baseline = {'music': 'bach', 'art': 'rembrandt'}

Doc/library/datetime.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2153,7 +2153,7 @@ There is one more :class:`tzinfo` method that a subclass may wish to override:
21532153

21542154
.. method:: tzinfo.fromutc(dt)
21552155

2156-
This is called from the default :class:`datetime.astimezone()`
2156+
This is called from the default :meth:`datetime.astimezone`
21572157
implementation. When called from that, ``dt.tzinfo`` is *self*, and *dt*'s
21582158
date and time data are to be viewed as expressing a UTC time. The purpose
21592159
of :meth:`fromutc` is to adjust the date and time data, returning an

Doc/library/decimal.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,48 @@ Decimal objects
897897
:const:`Rounded`. If given, applies *rounding*; otherwise, uses the
898898
rounding method in either the supplied *context* or the current context.
899899

900+
Decimal numbers can be rounded using the :func:`.round` function:
901+
902+
.. describe:: round(number)
903+
.. describe:: round(number, ndigits)
904+
905+
If *ndigits* is not given or ``None``,
906+
returns the nearest :class:`int` to *number*,
907+
rounding ties to even, and ignoring the rounding mode of the
908+
:class:`Decimal` context. Raises :exc:`OverflowError` if *number* is an
909+
infinity or :exc:`ValueError` if it is a (quiet or signaling) NaN.
910+
911+
If *ndigits* is an :class:`int`, the context's rounding mode is respected
912+
and a :class:`Decimal` representing *number* rounded to the nearest
913+
multiple of ``Decimal('1E-ndigits')`` is returned; in this case,
914+
``round(number, ndigits)`` is equivalent to
915+
``self.quantize(Decimal('1E-ndigits'))``. Returns ``Decimal('NaN')`` if
916+
*number* is a quiet NaN. Raises :class:`InvalidOperation` if *number*
917+
is an infinity, a signaling NaN, or if the length of the coefficient after
918+
the quantize operation would be greater than the current context's
919+
precision. In other words, for the non-corner cases:
920+
921+
* if *ndigits* is positive, return *number* rounded to *ndigits* decimal
922+
places;
923+
* if *ndigits* is zero, return *number* rounded to the nearest integer;
924+
* if *ndigits* is negative, return *number* rounded to the nearest
925+
multiple of ``10**abs(ndigits)``.
926+
927+
For example::
928+
929+
>>> from decimal import Decimal, getcontext, ROUND_DOWN
930+
>>> getcontext().rounding = ROUND_DOWN
931+
>>> round(Decimal('3.75')) # context rounding ignored
932+
4
933+
>>> round(Decimal('3.5')) # round-ties-to-even
934+
4
935+
>>> round(Decimal('3.75'), 0) # uses the context rounding
936+
Decimal('3')
937+
>>> round(Decimal('3.75'), 1)
938+
Decimal('3.7')
939+
>>> round(Decimal('3.75'), -1)
940+
Decimal('0E+1')
941+
900942

901943
.. _logical_operands_label:
902944

Doc/library/email.header.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Here is the :class:`Header` class description:
7777
The maximum line length can be specified explicitly via *maxlinelen*. For
7878
splitting the first line to a shorter value (to account for the field header
7979
which isn't included in *s*, e.g. :mailheader:`Subject`) pass in the name of the
80-
field in *header_name*. The default *maxlinelen* is 76, and the default value
80+
field in *header_name*. The default *maxlinelen* is 78, and the default value
8181
for *header_name* is ``None``, meaning it is not taken into account for the
8282
first line of a long, split header.
8383

Doc/library/fileinput.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Lines are returned with any newlines intact, which means that the last line in
4747
a file may not have one.
4848

4949
You can control how files are opened by providing an opening hook via the
50-
*openhook* parameter to :func:`fileinput.input` or :class:`FileInput()`. The
50+
*openhook* parameter to :func:`fileinput.input` or :func:`FileInput`. The
5151
hook must be a function that takes two arguments, *filename* and *mode*, and
5252
returns an accordingly opened file-like object. If *encoding* and/or *errors*
5353
are specified, they will be passed to the hook as additional keyword arguments.

Doc/library/multiprocessing.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,8 @@ For an example of the usage of queues for interprocess communication see
837837
Return ``True`` if the queue is empty, ``False`` otherwise. Because of
838838
multithreading/multiprocessing semantics, this is not reliable.
839839

840+
May raise an :exc:`OSError` on closed queues. (not guaranteed)
841+
840842
.. method:: full()
841843

842844
Return ``True`` if the queue is full, ``False`` otherwise. Because of
@@ -940,6 +942,8 @@ For an example of the usage of queues for interprocess communication see
940942

941943
Return ``True`` if the queue is empty, ``False`` otherwise.
942944

945+
Always raises an :exc:`OSError` if the SimpleQueue is closed.
946+
943947
.. method:: get()
944948

945949
Remove and return an item from the queue.

Doc/library/os.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ process and user.
193193
to the environment made after this time are not reflected in :data:`os.environ`,
194194
except for changes made by modifying :data:`os.environ` directly.
195195

196+
The :meth:`!os.environ.refresh()` method updates :data:`os.environ` with
197+
changes to the environment made by :func:`os.putenv`, by
198+
:func:`os.unsetenv`, or made outside Python in the same process.
199+
196200
This mapping may be used to modify the environment as well as query the
197201
environment. :func:`putenv` will be called automatically when the mapping
198202
is modified.
@@ -225,6 +229,9 @@ process and user.
225229
.. versionchanged:: 3.9
226230
Updated to support :pep:`584`'s merge (``|``) and update (``|=``) operators.
227231

232+
.. versionchanged:: 3.14
233+
Added the :meth:`!os.environ.refresh()` method.
234+
228235

229236
.. data:: environb
230237

@@ -561,6 +568,8 @@ process and user.
561568
of :data:`os.environ`. This also applies to :func:`getenv` and :func:`getenvb`, which
562569
respectively use :data:`os.environ` and :data:`os.environb` in their implementations.
563570

571+
See also the :data:`os.environ.refresh() <os.environ>` method.
572+
564573
.. note::
565574

566575
On some platforms, including FreeBSD and macOS, setting ``environ`` may
@@ -809,6 +818,8 @@ process and user.
809818
don't update :data:`os.environ`, so it is actually preferable to delete items of
810819
:data:`os.environ`.
811820

821+
See also the :data:`os.environ.refresh() <os.environ>` method.
822+
812823
.. audit-event:: os.unsetenv key os.unsetenv
813824

814825
.. versionchanged:: 3.9

0 commit comments

Comments
 (0)