Skip to content

Commit

Permalink
Merge branch 'main' into feature/array-module-free-threaded
Browse files Browse the repository at this point in the history
  • Loading branch information
SonicField authored Jun 13, 2024
2 parents e5f52ea + 030b452 commit 3422bf6
Show file tree
Hide file tree
Showing 207 changed files with 3,213 additions and 941 deletions.
15 changes: 10 additions & 5 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Python/bytecodes.c @markshannon
Python/optimizer*.c @markshannon
Python/optimizer_analysis.c @Fidget-Spinner
Python/optimizer_bytecodes.c @Fidget-Spinner
Python/symtable.c @JelleZijlstra @carljm
Lib/_pyrepl/* @pablogsal @lysnikolaou @ambv
Lib/test/test_patma.py @brandtbucher
Lib/test/test_type_*.py @JelleZijlstra
Expand Down Expand Up @@ -153,10 +154,10 @@ Include/internal/pycore_time.h @pganssle @abalkin
/Tools/cases_generator/ @markshannon

# AST
Python/ast.c @isidentical
Parser/asdl.py @isidentical
Parser/asdl_c.py @isidentical
Lib/ast.py @isidentical
Python/ast.c @isidentical @JelleZijlstra
Parser/asdl.py @isidentical @JelleZijlstra
Parser/asdl_c.py @isidentical @JelleZijlstra
Lib/ast.py @isidentical @JelleZijlstra

# Mock
/Lib/unittest/mock.py @cjw296
Expand All @@ -173,6 +174,10 @@ Lib/ast.py @isidentical
/Lib/test/test_subprocess.py @gpshead
/Modules/*subprocess* @gpshead

# debugger
**/*pdb* @gaogaotiantian
**/*bdb* @gaogaotiantian

# Limited C API & stable ABI
Tools/build/stable_abi.py @encukou
Misc/stable_abi.toml @encukou
Expand Down Expand Up @@ -240,7 +245,7 @@ Doc/howto/clinic.rst @erlend-aasland
**/*interpreteridobject.* @ericsnowcurrently
**/*crossinterp* @ericsnowcurrently
Lib/test/support/interpreters/ @ericsnowcurrently
Modules/_xx*interp*module.c @ericsnowcurrently
Modules/_interp*module.c @ericsnowcurrently
Lib/test/test_interpreters/ @ericsnowcurrently

# Android
Expand Down
3 changes: 2 additions & 1 deletion Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@
html_context = {
"is_deployment_preview": os.getenv("READTHEDOCS_VERSION_TYPE") == "external",
"repository_url": repository_url.removesuffix(".git") if repository_url else None,
"pr_id": os.getenv("READTHEDOCS_VERSION")
"pr_id": os.getenv("READTHEDOCS_VERSION"),
"enable_analytics": os.getenv("PYTHON_DOCS_ENABLE_ANALYTICS"),
}

# This 'Last updated on:' timestamp is inserted at the bottom of every page.
Expand Down
2 changes: 1 addition & 1 deletion Doc/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ Glossary
therefore it is never deallocated.

Built-in strings and singletons are immortal objects. For example,
:const:`True` and :const:`None` singletons are immmortal.
:const:`True` and :const:`None` singletons are immortal.

See `PEP 683 – Immortal Objects, Using a Fixed Refcount
<https://peps.python.org/pep-0683/>`_ for more information.
Expand Down
2 changes: 1 addition & 1 deletion Doc/howto/descriptor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ Invocation from super
---------------------

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

A dotted lookup such as ``super(A, obj).m`` searches ``obj.__class__.__mro__``
for the base class ``B`` immediately following ``A`` and then returns
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ The class can be used to simulate nested scopes and is useful in templating.
:func:`super` function. A reference to ``d.parents`` is equivalent to:
``ChainMap(*d.maps[1:])``.

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

>>> baseline = {'music': 'bach', 'art': 'rembrandt'}
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2153,7 +2153,7 @@ There is one more :class:`tzinfo` method that a subclass may wish to override:

.. method:: tzinfo.fromutc(dt)

This is called from the default :class:`datetime.astimezone()`
This is called from the default :meth:`datetime.astimezone`
implementation. When called from that, ``dt.tzinfo`` is *self*, and *dt*'s
date and time data are to be viewed as expressing a UTC time. The purpose
of :meth:`fromutc` is to adjust the date and time data, returning an
Expand Down
42 changes: 42 additions & 0 deletions Doc/library/decimal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,48 @@ Decimal objects
:const:`Rounded`. If given, applies *rounding*; otherwise, uses the
rounding method in either the supplied *context* or the current context.

Decimal numbers can be rounded using the :func:`.round` function:

.. describe:: round(number)
.. describe:: round(number, ndigits)

If *ndigits* is not given or ``None``,
returns the nearest :class:`int` to *number*,
rounding ties to even, and ignoring the rounding mode of the
:class:`Decimal` context. Raises :exc:`OverflowError` if *number* is an
infinity or :exc:`ValueError` if it is a (quiet or signaling) NaN.

If *ndigits* is an :class:`int`, the context's rounding mode is respected
and a :class:`Decimal` representing *number* rounded to the nearest
multiple of ``Decimal('1E-ndigits')`` is returned; in this case,
``round(number, ndigits)`` is equivalent to
``self.quantize(Decimal('1E-ndigits'))``. Returns ``Decimal('NaN')`` if
*number* is a quiet NaN. Raises :class:`InvalidOperation` if *number*
is an infinity, a signaling NaN, or if the length of the coefficient after
the quantize operation would be greater than the current context's
precision. In other words, for the non-corner cases:

* if *ndigits* is positive, return *number* rounded to *ndigits* decimal
places;
* if *ndigits* is zero, return *number* rounded to the nearest integer;
* if *ndigits* is negative, return *number* rounded to the nearest
multiple of ``10**abs(ndigits)``.

For example::

>>> from decimal import Decimal, getcontext, ROUND_DOWN
>>> getcontext().rounding = ROUND_DOWN
>>> round(Decimal('3.75')) # context rounding ignored
4
>>> round(Decimal('3.5')) # round-ties-to-even
4
>>> round(Decimal('3.75'), 0) # uses the context rounding
Decimal('3')
>>> round(Decimal('3.75'), 1)
Decimal('3.7')
>>> round(Decimal('3.75'), -1)
Decimal('0E+1')


.. _logical_operands_label:

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/dis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1667,7 +1667,7 @@ iterations of the loop.

A no-op. Performs internal tracing, debugging and optimization checks.

The ``context`` oparand consists of two parts. The lowest two bits
The ``context`` operand consists of two parts. The lowest two bits
indicate where the ``RESUME`` occurs:

* ``0`` The start of a function, which is neither a generator, coroutine
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/email.header.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Here is the :class:`Header` class description:
The maximum line length can be specified explicitly via *maxlinelen*. For
splitting the first line to a shorter value (to account for the field header
which isn't included in *s*, e.g. :mailheader:`Subject`) pass in the name of the
field in *header_name*. The default *maxlinelen* is 76, and the default value
field in *header_name*. The default *maxlinelen* is 78, and the default value
for *header_name* is ``None``, meaning it is not taken into account for the
first line of a long, split header.

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/fileinput.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Lines are returned with any newlines intact, which means that the last line in
a file may not have one.

You can control how files are opened by providing an opening hook via the
*openhook* parameter to :func:`fileinput.input` or :class:`FileInput()`. The
*openhook* parameter to :func:`fileinput.input` or :func:`FileInput`. The
hook must be a function that takes two arguments, *filename* and *mode*, and
returns an accordingly opened file-like object. If *encoding* and/or *errors*
are specified, they will be passed to the hook as additional keyword arguments.
Expand Down
4 changes: 3 additions & 1 deletion Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,9 @@ are always available. They are listed here in alphabetical order.
returns ``100``, but ``pow(10, -2)`` returns ``0.01``. For a negative base of
type :class:`int` or :class:`float` and a non-integral exponent, a complex
result is delivered. For example, ``pow(-9, 0.5)`` returns a value close
to ``3j``.
to ``3j``. Whereas, for a negative base of type :class:`int` or :class:`float`
with an integral exponent, a float result is delivered. For example,
``pow(-9, 2.0)`` returns ``81.0``.

For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must
also be of integer type and *mod* must be nonzero. If *mod* is present and
Expand Down
11 changes: 11 additions & 0 deletions Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ process and user.
to the environment made after this time are not reflected in :data:`os.environ`,
except for changes made by modifying :data:`os.environ` directly.

The :meth:`!os.environ.refresh()` method updates :data:`os.environ` with
changes to the environment made by :func:`os.putenv`, by
:func:`os.unsetenv`, or made outside Python in the same process.

This mapping may be used to modify the environment as well as query the
environment. :func:`putenv` will be called automatically when the mapping
is modified.
Expand Down Expand Up @@ -225,6 +229,9 @@ process and user.
.. versionchanged:: 3.9
Updated to support :pep:`584`'s merge (``|``) and update (``|=``) operators.

.. versionchanged:: 3.14
Added the :meth:`!os.environ.refresh()` method.


.. data:: environb

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

See also the :data:`os.environ.refresh() <os.environ>` method.

.. note::

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

See also the :data:`os.environ.refresh() <os.environ>` method.

.. audit-event:: os.unsetenv key os.unsetenv

.. versionchanged:: 3.9
Expand Down
Loading

0 comments on commit 3422bf6

Please sign in to comment.