Skip to content

Commit

Permalink
Merge branch 'main' into astattr
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra authored Jul 11, 2024
2 parents f9118ab + e6264b4 commit 1cc2ed0
Show file tree
Hide file tree
Showing 166 changed files with 2,542 additions and 1,122 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ENV WASI_SDK_VERSION=21
ENV WASI_SDK_PATH=/opt/wasi-sdk

ENV WASMTIME_HOME=/opt/wasmtime
ENV WASMTIME_VERSION=18.0.3
ENV WASMTIME_VERSION=22.0.0
ENV WASMTIME_CPU_ARCH=x86_64

RUN dnf -y --nodocs --setopt=install_weak_deps=False install /usr/bin/{blurb,clang,curl,git,ln,tar,xz} 'dnf-command(builddep)' && \
Expand Down
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Include/internal/pycore_freelist.h @ericsnowcurrently
Include/internal/pycore_global_objects.h @ericsnowcurrently
Include/internal/pycore_obmalloc.h @ericsnowcurrently
Include/internal/pycore_pymem.h @ericsnowcurrently
Include/internal/pycore_stackref.h @Fidget-Spinner
Modules/main.c @ericsnowcurrently
Programs/_bootstrap_python.c @ericsnowcurrently
Programs/python.c @ericsnowcurrently
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/reusable-wasi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
timeout-minutes: 60
runs-on: ubuntu-22.04
env:
WASMTIME_VERSION: 18.0.3
WASMTIME_VERSION: 22.0.0
WASI_SDK_VERSION: 21
WASI_SDK_PATH: /opt/wasi-sdk
CROSS_BUILD_PYTHON: cross-build/build
Expand All @@ -20,9 +20,9 @@ jobs:
- uses: actions/checkout@v4
# No problem resolver registered as one doesn't currently exist for Clang.
- name: "Install wasmtime"
uses: jcbhmr/setup-wasmtime@v2
uses: bytecodealliance/actions/wasmtime/setup@v1
with:
wasmtime-version: ${{ env.WASMTIME_VERSION }}
version: ${{ env.WASMTIME_VERSION }}
- name: "Restore WASI SDK"
id: cache-wasi-sdk
uses: actions/cache@v4
Expand Down Expand Up @@ -50,8 +50,10 @@ jobs:
uses: actions/cache@v4
with:
path: ${{ env.CROSS_BUILD_PYTHON }}/config.cache
# Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}-${{ env.pythonLocation }}
# Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python.
# Include the hash of `Tools/wasm/wasi.py` as it may change the environment variables.
# (Make sure to keep the key in sync with the other config.cache step below.)
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ env.WASI_SDK_VERSION }}-${{ env.WASMTIME_VERSION }}-${{ inputs.config_hash }}-${{ hashFiles('Tools/wasm/wasi.py') }}-${{ env.pythonLocation }}
- name: "Configure build Python"
run: python3 Tools/wasm/wasi.py configure-build-python -- --config-cache --with-pydebug
- name: "Make build Python"
Expand All @@ -60,8 +62,8 @@ jobs:
uses: actions/cache@v4
with:
path: ${{ env.CROSS_BUILD_WASI }}/config.cache
# Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-wasi-sdk-${{ env.WASI_SDK_VERSION }}-${{ inputs.config_hash }}-${{ env.pythonLocation }}
# Should be kept in sync with the other config.cache step above.
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ env.WASI_SDK_VERSION }}-${{ env.WASMTIME_VERSION }}-${{ inputs.config_hash }}-${{ hashFiles('Tools/wasm/wasi.py') }}-${{ env.pythonLocation }}
- name: "Configure host"
# `--with-pydebug` inferred from configure-build-python
run: python3 Tools/wasm/wasi.py configure-host -- --config-cache
Expand Down
9 changes: 6 additions & 3 deletions Doc/c-api/cell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ Cell objects are not likely to be useful elsewhere.
.. c:function:: PyObject* PyCell_Get(PyObject *cell)
Return the contents of the cell *cell*.
Return the contents of the cell *cell*, which can be ``NULL``.
If *cell* is not a cell object, returns ``NULL`` with an exception set.
.. c:function:: PyObject* PyCell_GET(PyObject *cell)
Expand All @@ -52,8 +53,10 @@ Cell objects are not likely to be useful elsewhere.
Set the contents of the cell object *cell* to *value*. This releases the
reference to any current content of the cell. *value* may be ``NULL``. *cell*
must be non-``NULL``; if it is not a cell object, ``-1`` will be returned. On
success, ``0`` will be returned.
must be non-``NULL``.
On success, return ``0``.
If *cell* is not a cell object, set an exception and return ``-1``.
.. c:function:: void PyCell_SET(PyObject *cell, PyObject *value)
Expand Down
23 changes: 15 additions & 8 deletions Doc/c-api/module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Module Objects
to ``None``); the caller is responsible for providing a :attr:`__file__`
attribute.
Return ``NULL`` with an exception set on error.
.. versionadded:: 3.3
.. versionchanged:: 3.4
Expand Down Expand Up @@ -265,6 +267,8 @@ of the following two module creation functions:
API version *module_api_version*. If that version does not match the version
of the running interpreter, a :exc:`RuntimeWarning` is emitted.
Return ``NULL`` with an exception set on error.
.. note::
Most uses of this function should be using :c:func:`PyModule_Create`
Expand Down Expand Up @@ -461,6 +465,8 @@ objects dynamically. Note that both ``PyModule_FromDefAndSpec`` and
If that version does not match the version of the running interpreter,
a :exc:`RuntimeWarning` is emitted.
Return ``NULL`` with an exception set on error.
.. note::
Most uses of this function should be using :c:func:`PyModule_FromDefAndSpec`
Expand Down Expand Up @@ -601,23 +607,24 @@ state:
.. c:function:: int PyModule_AddIntConstant(PyObject *module, const char *name, long value)
Add an integer constant to *module* as *name*. This convenience function can be
used from the module's initialization function. Return ``-1`` on error, ``0`` on
success.
used from the module's initialization function.
Return ``-1`` with an exception set on error, ``0`` on success.
.. c:function:: int PyModule_AddStringConstant(PyObject *module, const char *name, const char *value)
Add a string constant to *module* as *name*. This convenience function can be
used from the module's initialization function. The string *value* must be
``NULL``-terminated. Return ``-1`` on error, ``0`` on success.
``NULL``-terminated.
Return ``-1`` with an exception set on error, ``0`` on success.
.. c:macro:: PyModule_AddIntMacro(module, macro)
Add an int constant to *module*. The name and the value are taken from
*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int
constant *AF_INET* with the value of *AF_INET* to *module*.
Return ``-1`` on error, ``0`` on success.
Return ``-1`` with an exception set on error, ``0`` on success.
.. c:macro:: PyModule_AddStringMacro(module, macro)
Expand All @@ -630,7 +637,7 @@ state:
The type object is finalized by calling internally :c:func:`PyType_Ready`.
The name of the type object is taken from the last component of
:c:member:`~PyTypeObject.tp_name` after dot.
Return ``-1`` on error, ``0`` on success.
Return ``-1`` with an exception set on error, ``0`` on success.
.. versionadded:: 3.9
Expand All @@ -643,7 +650,7 @@ state:
import machinery assumes the module does not support running without the
GIL. This function is only available in Python builds configured with
:option:`--disable-gil`.
Return ``-1`` on error, ``0`` on success.
Return ``-1`` with an exception set on error, ``0`` on success.
.. versionadded:: 3.13
Expand Down Expand Up @@ -682,14 +689,14 @@ since multiple such modules can be created from a single definition.
The caller must hold the GIL.
Return 0 on success or -1 on failure.
Return ``-1`` with an exception set on error, ``0`` on success.
.. versionadded:: 3.3
.. c:function:: int PyState_RemoveModule(PyModuleDef *def)
Removes the module object created from *def* from the interpreter state.
Return 0 on success or -1 on failure.
Return ``-1`` with an exception set on error, ``0`` on success.
The caller must hold the GIL.
Expand Down
1 change: 1 addition & 0 deletions Doc/c-api/object.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Object Protocol
The reference is borrowed from the interpreter, and is valid until the
interpreter finalization.
.. versionadded:: 3.13
Expand Down
8 changes: 5 additions & 3 deletions Doc/c-api/slice.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ Slice Objects
Return a new slice object with the given values. The *start*, *stop*, and
*step* parameters are used as the values of the slice object attributes of
the same names. Any of the values may be ``NULL``, in which case the
``None`` will be used for the corresponding attribute. Return ``NULL`` if
``None`` will be used for the corresponding attribute.
Return ``NULL`` with an exception set if
the new object could not be allocated.
Expand Down Expand Up @@ -52,7 +54,7 @@ Slice Objects
of bounds indices are clipped in a manner consistent with the handling of
normal slices.
Returns ``0`` on success and ``-1`` on error with exception set.
Return ``0`` on success and ``-1`` on error with an exception set.
.. note::
This function is considered not safe for resizable sequences.
Expand Down Expand Up @@ -95,7 +97,7 @@ Slice Objects
``PY_SSIZE_T_MIN`` to ``PY_SSIZE_T_MIN``, and silently boost the step
values less than ``-PY_SSIZE_T_MAX`` to ``-PY_SSIZE_T_MAX``.
Return ``-1`` on error, ``0`` on success.
Return ``-1`` with an exception set on error, ``0`` on success.
.. versionadded:: 3.6.1
Expand Down
3 changes: 3 additions & 0 deletions Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@
('c:data', 'PyExc_UnicodeWarning'),
('c:data', 'PyExc_UserWarning'),
('c:data', 'PyExc_Warning'),
# Undocumented public C macros
('c:macro', 'Py_BUILD_ASSERT'),
('c:macro', 'Py_BUILD_ASSERT_EXPR'),
# Do not error nit-picky mode builds when _SubParsersAction.add_parser cannot
# be resolved, as the method is currently undocumented. For context, see
# https://github.com/python/cpython/pull/103289.
Expand Down
6 changes: 3 additions & 3 deletions Doc/library/__main__.rst
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ attribute will include the package's path if imported::
>>> asyncio.__main__.__name__
'asyncio.__main__'

This won't work for ``__main__.py`` files in the root directory of a .zip file
though. Hence, for consistency, minimal ``__main__.py`` like the :mod:`venv`
one mentioned below are preferred.
This won't work for ``__main__.py`` files in the root directory of a
``.zip`` file though. Hence, for consistency, a minimal ``__main__.py``
without a ``__name__`` check is preferred.

.. seealso::

Expand Down
3 changes: 3 additions & 0 deletions Doc/library/asyncio-eventloop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,9 @@ Executing code in thread or process pools

The *executor* argument should be an :class:`concurrent.futures.Executor`
instance. The default executor is used if *executor* is ``None``.
The default executor can be set by :meth:`loop.set_default_executor`,
otherwise, a :class:`concurrent.futures.ThreadPoolExecutor` will be
lazy-initialized and used by :func:`run_in_executor` if needed.

Example::

Expand Down
4 changes: 4 additions & 0 deletions Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1934,6 +1934,10 @@ are always available. They are listed here in alphabetical order.
.. versionchanged:: 3.12 Summation of floats switched to an algorithm
that gives higher accuracy and better commutativity on most builds.

.. versionchanged:: 3.14
Added specialization for summation of complexes,
using same algorithm as for summation of floats.


.. class:: super()
super(type, object_or_type=None)
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/os.path.rst
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ the :mod:`glob` module.)
that contains symbolic links. On Windows, it converts forward slashes to
backward slashes. To normalize case, use :func:`normcase`.

.. note::
.. note::
On POSIX systems, in accordance with `IEEE Std 1003.1 2013 Edition; 4.13
Pathname Resolution <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>`_,
if a pathname begins with exactly two slashes, the first component
Expand Down
12 changes: 6 additions & 6 deletions Doc/library/pathlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ Creating files and directories
Copying, renaming and deleting
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. method:: Path.copy(target, *, follow_symlinks=True)
.. method:: Path.copy(target, *, follow_symlinks=True, preserve_metadata=False)

Copy the contents of this file to the *target* file. If *target* specifies
a file that already exists, it will be replaced.
Expand All @@ -1548,11 +1548,11 @@ Copying, renaming and deleting
will be created as a symbolic link. If *follow_symlinks* is true and this
file is a symbolic link, *target* will be a copy of the symlink target.

.. note::
This method uses operating system functionality to copy file content
efficiently. The OS might also copy some metadata, such as file
permissions. After the copy is complete, users may wish to call
:meth:`Path.chmod` to set the permissions of the target file.
If *preserve_metadata* is false (the default), only the file data is
guaranteed to be copied. Set *preserve_metadata* to true to ensure that the
file mode (permissions), flags, last access and modification times, and
extended attributes are copied where supported. This argument has no effect
on Windows, where metadata is always preserved when copying.

.. versionadded:: 3.14

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/profile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ you are using :class:`profile.Profile` or :class:`cProfile.Profile`,
As the :class:`cProfile.Profile` class cannot be calibrated, custom timer
functions should be used with care and should be as fast as possible. For
the best results with a custom timer, it might be necessary to hard-code it
in the C source of the internal :mod:`_lsprof` module.
in the C source of the internal :mod:`!_lsprof` module.

Python 3.3 adds several new functions in :mod:`time` that can be used to make
precise measurements of process or wall-clock time. For example, see
Expand Down
16 changes: 10 additions & 6 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2095,8 +2095,9 @@ expression support in the :mod:`re` module).
If *sep* is given, consecutive delimiters are not grouped together and are
deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns
``['1', '', '2']``). The *sep* argument may consist of multiple characters
(for example, ``'1<>2<>3'.split('<>')`` returns ``['1', '2', '3']``).
Splitting an empty string with a specified separator returns ``['']``.
as a single delimiter (to split with multiple delimiters, use
:func:`re.split`). Splitting an empty string with a specified separator
returns ``['']``.

For example::

Expand All @@ -2106,6 +2107,8 @@ expression support in the :mod:`re` module).
['1', '2,3']
>>> '1,2,,3,'.split(',')
['1', '2', '', '3', '']
>>> '1<>2<>3<4'.split('<>')
['1', '2', '3<4']

If *sep* is not specified or is ``None``, a different splitting algorithm is
applied: runs of consecutive whitespace are regarded as a single separator,
Expand Down Expand Up @@ -3149,10 +3152,9 @@ produce new objects.
If *sep* is given, consecutive delimiters are not grouped together and are
deemed to delimit empty subsequences (for example, ``b'1,,2'.split(b',')``
returns ``[b'1', b'', b'2']``). The *sep* argument may consist of a
multibyte sequence (for example, ``b'1<>2<>3'.split(b'<>')`` returns
``[b'1', b'2', b'3']``). Splitting an empty sequence with a specified
separator returns ``[b'']`` or ``[bytearray(b'')]`` depending on the type
of object being split. The *sep* argument may be any
multibyte sequence as a single delimiter. Splitting an empty sequence with
a specified separator returns ``[b'']`` or ``[bytearray(b'')]`` depending
on the type of object being split. The *sep* argument may be any
:term:`bytes-like object`.

For example::
Expand All @@ -3163,6 +3165,8 @@ produce new objects.
[b'1', b'2,3']
>>> b'1,2,,3,'.split(b',')
[b'1', b'2', b'', b'3', b'']
>>> b'1<>2<>3<4'.split(b'<>')
[b'1', b'2', b'3<4']

If *sep* is not specified or is ``None``, a different splitting algorithm
is applied: runs of consecutive ASCII whitespace are regarded as a single
Expand Down
2 changes: 1 addition & 1 deletion Doc/reference/simple_stmts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ statements, cannot be an unpacking) and the expression list, performs the binary
operation specific to the type of assignment on the two operands, and assigns
the result to the original target. The target is only evaluated once.

An augmented assignment expression like ``x += 1`` can be rewritten as ``x = x +
An augmented assignment statement like ``x += 1`` can be rewritten as ``x = x +
1`` to achieve a similar, but not exactly equal effect. In the augmented
version, ``x`` is only evaluated once. Also, when possible, the actual operation
is performed *in-place*, meaning that rather than creating a new object and
Expand Down
2 changes: 1 addition & 1 deletion Doc/requirements-oldest-sphinx.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ python-docs-theme>=2022.1

alabaster==0.7.16
Babel==2.15.0
certifi==2024.6.2
certifi==2024.7.4
charset-normalizer==3.3.2
docutils==0.19
idna==3.7
Expand Down
2 changes: 1 addition & 1 deletion Doc/tools/check-warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from typing import TextIO

# Fail if NEWS nit found before this line number
NEWS_NIT_THRESHOLD = 200
NEWS_NIT_THRESHOLD = 1700

# Exclude these whether they're dirty or clean,
# because they trigger a rebuild of dirty files.
Expand Down
4 changes: 2 additions & 2 deletions Doc/using/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ Options for third-party dependencies
.. option:: PANEL_CFLAGS
.. option:: PANEL_LIBS

C compiler and Linker flags for PANEL, overriding ``pkg-config``.
C compiler and linker flags for PANEL, overriding ``pkg-config``.

C compiler and linker flags for ``libpanel`` or ``libpanelw``, used by
:mod:`curses.panel` module, overriding ``pkg-config``.
Expand Down Expand Up @@ -615,7 +615,7 @@ also be used to improve performance.

.. option:: --without-mimalloc

Disable the fast mimalloc allocator :ref:`mimalloc <mimalloc>`
Disable the fast :ref:`mimalloc <mimalloc>` allocator
(enabled by default).

See also :envvar:`PYTHONMALLOC` environment variable.
Expand Down
Loading

0 comments on commit 1cc2ed0

Please sign in to comment.