Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into pep649-fakevalue
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra committed Sep 25, 2024
2 parents ddacdb7 + 6318ffc commit 5bb1d1e
Show file tree
Hide file tree
Showing 100 changed files with 1,729 additions and 623 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,14 @@ jobs:

build_ubuntu_ssltests:
name: 'Ubuntu SSL tests with OpenSSL'
runs-on: ubuntu-22.04
runs-on: ${{ matrix.os }}
timeout-minutes: 60
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
openssl_ver: [3.0.15, 3.1.7, 3.2.3, 3.3.2]
env:
OPENSSL_VER: ${{ matrix.openssl_ver }}
Expand Down Expand Up @@ -231,7 +232,7 @@ jobs:
uses: actions/cache@v4
with:
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
key: ${{ matrix.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
- name: Install OpenSSL
if: steps.cache-openssl.outputs.cache-hit != 'true'
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
Expand Down Expand Up @@ -410,7 +411,7 @@ jobs:
uses: actions/cache@v4
with:
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
key: ${{ matrix.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
- name: Install OpenSSL
if: steps.cache-openssl.outputs.cache-hit != 'true'
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/jit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,15 @@ jobs:
- name: Native Windows
if: runner.os == 'Windows' && matrix.architecture != 'ARM64'
run: |
choco upgrade llvm -y
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.0
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '--pgo' }} -p ${{ matrix.architecture }}
./PCbuild/rt.bat ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3
# No PGO or tests (yet):
- name: Emulated Windows
if: runner.os == 'Windows' && matrix.architecture == 'ARM64'
run: |
choco upgrade llvm -y
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.0
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }}
- name: Native macOS
Expand Down Expand Up @@ -159,7 +157,7 @@ jobs:
CC="${{ matrix.compiler == 'clang' && 'clang --target=$HOST' || '$HOST-gcc' }}" \
CPP="$CC --preprocess" \
HOSTRUNNER=qemu-${{ matrix.architecture }} \
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }} --build=x86_64-linux-gnu --host="$HOST" --with-build-python=../build/bin/python3 --with-pkg-config=no ac_cv_buggy_getaddrinfo=no ac_cv_file__dev_ptc=no ac_cv_file__dev_ptmx=yes
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--with-lto' }} --build=x86_64-linux-gnu --host="$HOST" --with-build-python=../build/bin/python3 --with-pkg-config=no ac_cv_buggy_getaddrinfo=no ac_cv_file__dev_ptc=no ac_cv_file__dev_ptmx=yes
make all --jobs 4
./python -m test --ignorefile=Tools/jit/ignore-tests-emulated-linux.txt --multiprocess 0 --timeout 4500 --verbose2 --verbose3
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/reusable-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ jobs:
build_ubuntu_reusable:
name: 'build and test'
timeout-minutes: 60
runs-on: ubuntu-22.04
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
env:
FORCE_COLOR: 1
OPENSSL_VER: 3.0.15
Expand All @@ -36,7 +40,7 @@ jobs:
uses: actions/cache@v4
with:
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
key: ${{ matrix.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
- name: Install OpenSSL
if: steps.cache-openssl.outputs.cache-hit != 'true'
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
Expand Down
1 change: 1 addition & 0 deletions Doc/data/stable_abi.dat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions Doc/library/argparse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,12 @@ The following sections describe how each of these are used.
prog
^^^^

By default, :class:`ArgumentParser` objects use ``sys.argv[0]`` to determine
By default, :class:`ArgumentParser` objects use the base name
(see :func:`os.path.basename`) of ``sys.argv[0]`` to determine
how to display the name of the program in help messages. This default is almost
always desirable because it will make the help messages match how the program was
invoked on the command line. For example, consider a file named
``myprogram.py`` with the following code::
always desirable because it will make the help messages match the name that was
used to invoke the program on the command line. For example, consider a file
named ``myprogram.py`` with the following code::

import argparse
parser = argparse.ArgumentParser()
Expand Down Expand Up @@ -1122,6 +1123,9 @@ is used when no command-line argument was present::
>>> parser.parse_args([])
Namespace(foo=42)

For required_ arguments, the ``default`` value is ignored. For example, this
applies to positional arguments with nargs_ values other than ``?`` or ``*``,
or optional arguments marked as ``required=True``.

Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if the
command-line argument was not present::
Expand Down
24 changes: 20 additions & 4 deletions Doc/library/calendar.rst
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,22 @@ The :mod:`calendar` module exports the following data attributes:

.. data:: day_name

An array that represents the days of the week in the current locale.
A sequence that represents the days of the week in the current locale,
where Monday is day number 0.

>>> import calendar
>>> list(calendar.day_name)
['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']


.. data:: day_abbr

An array that represents the abbreviated days of the week in the current locale.
A sequence that represents the abbreviated days of the week in the current locale,
where Mon is day number 0.

>>> import calendar
>>> list(calendar.day_abbr)
['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']

.. data:: MONDAY
TUESDAY
Expand All @@ -426,17 +435,24 @@ The :mod:`calendar` module exports the following data attributes:

.. data:: month_name

An array that represents the months of the year in the current locale. This
A sequence that represents the months of the year in the current locale. This
follows normal convention of January being month number 1, so it has a length of
13 and ``month_name[0]`` is the empty string.

>>> import calendar
>>> list(calendar.month_name)
['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']


.. data:: month_abbr

An array that represents the abbreviated months of the year in the current
A sequence that represents the abbreviated months of the year in the current
locale. This follows normal convention of January being month number 1, so it
has a length of 13 and ``month_abbr[0]`` is the empty string.

>>> import calendar
>>> list(calendar.month_abbr)
['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']

.. data:: JANUARY
FEBRUARY
Expand Down
7 changes: 0 additions & 7 deletions Doc/library/dataclasses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,6 @@ Module contents
If :attr:`!__slots__` is already defined in the class, then :exc:`TypeError`
is raised.

.. warning::
Calling no-arg :func:`super` in dataclasses using ``slots=True``
will result in the following exception being raised:
``TypeError: super(type, obj): obj must be an instance or subtype of type``.
The two-arg :func:`super` is a valid workaround.
See :gh:`90562` for full details.

.. warning::
Passing parameters to a base class :meth:`~object.__init_subclass__`
when using ``slots=True`` will result in a :exc:`TypeError`.
Expand Down
6 changes: 6 additions & 0 deletions Doc/library/dis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1872,6 +1872,12 @@ but are replaced by real opcodes or removed before bytecode is generated.
Undirected relative jump instructions which are replaced by their
directed (forward/backward) counterparts by the assembler.

.. opcode:: JUMP_IF_TRUE
.. opcode:: JUMP_IF_FALSE

Conditional jumps which do not impact the stack. Replaced by the sequence
``COPY 1``, ``TO_BOOL``, ``POP_JUMP_IF_TRUE/FALSE``.

.. opcode:: LOAD_CLOSURE (i)

Pushes a reference to the cell contained in slot ``i`` of the "fast locals"
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4602,7 +4602,7 @@ written in Python, such as a mail server's external command delivery program.

See the :manpage:`pidfd_open(2)` man page for more details.

.. availability:: Linux >= 5.3
.. availability:: Linux >= 5.3, Android >= :func:`build-time <sys.getandroidapilevel>` API level 31
.. versionadded:: 3.9

.. data:: PIDFD_NONBLOCK
Expand Down
24 changes: 22 additions & 2 deletions Doc/library/pdb.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,15 @@ slightly different way:
is entered.


.. function:: set_trace(*, header=None)
.. function:: set_trace(*, header=None, commands=None)

Enter the debugger at the calling stack frame. This is useful to hard-code
a breakpoint at a given point in a program, even if the code is not
otherwise being debugged (e.g. when an assertion fails). If given,
*header* is printed to the console just before debugging begins.
The *commands* argument, if given, is a list of commands to execute
when the debugger starts.


.. versionchanged:: 3.7
The keyword-only argument *header*.
Expand All @@ -173,6 +176,9 @@ slightly different way:
:func:`set_trace` will enter the debugger immediately, rather than
on the next line of code to be executed.

.. versionadded:: 3.14
The *commands* argument.

.. function:: post_mortem(traceback=None)

Enter post-mortem debugging of the given *traceback* object. If no
Expand All @@ -192,7 +198,7 @@ The ``run*`` functions and :func:`set_trace` are aliases for instantiating the
access further features, you have to do this yourself:

.. class:: Pdb(completekey='tab', stdin=None, stdout=None, skip=None, \
nosigint=False, readrc=True)
nosigint=False, readrc=True, mode=None)

:class:`Pdb` is the debugger class.

Expand All @@ -211,6 +217,13 @@ access further features, you have to do this yourself:
The *readrc* argument defaults to true and controls whether Pdb will load
.pdbrc files from the filesystem.

The *mode* argument specifies how the debugger was invoked.
It impacts the workings of some debugger commands.
Valid values are ``'inline'`` (used by the breakpoint() builtin),
``'cli'`` (used by the command line invocation)
or ``None`` (for backwards compatible behaviour, as before the *mode*
argument was added).

Example call to enable tracing with *skip*::

import pdb; pdb.Pdb(skip=['django.*']).set_trace()
Expand All @@ -227,6 +240,9 @@ access further features, you have to do this yourself:
.. versionchanged:: 3.6
The *readrc* argument.

.. versionadded:: 3.14
Added the *mode* argument.

.. method:: run(statement, globals=None, locals=None)
runeval(expression, globals=None, locals=None)
runcall(function, *args, **kwds)
Expand Down Expand Up @@ -669,6 +685,10 @@ can be overridden by the local file.
History, breakpoints, actions and debugger options are preserved.
:pdbcmd:`restart` is an alias for :pdbcmd:`run`.

.. versionchanged:: 3.14
:pdbcmd:`run` and :pdbcmd:`restart` commands are disabled when the
debugger is invoked in ``'inline'`` mode.

.. pdbcommand:: q(uit)

Quit from the debugger. The program being executed is aborted.
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/random.rst
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ The following options are accepted:
.. option:: -f <N>
--float <N>

Print a random floating-point number between 1 and N inclusive,
Print a random floating-point number between 0 and N inclusive,
using :meth:`uniform`.

If no options are given, the output depends on the input:
Expand Down
13 changes: 7 additions & 6 deletions Doc/library/shutil.rst
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,10 @@ Directory and files operations
*mode* is a permission mask passed to :func:`os.access`, by default
determining if the file exists and is executable.

*path* is a "``PATH`` string" specifying the lookup directory list. When no
*path* is specified, the results of :func:`os.environ` are used, returning
either the "PATH" value or a fallback of :data:`os.defpath`.
*path* is a "``PATH`` string" specifying the directories to look in,
delimited by :data:`os.pathsep`. When no *path* is specified, the
:envvar:`PATH` environment variable is read from :data:`os.environ`,
falling back to :data:`os.defpath` if it is not set.

On Windows, the current directory is prepended to the *path* if *mode* does
not include ``os.X_OK``. When the *mode* does include ``os.X_OK``, the
Expand All @@ -460,9 +461,9 @@ Directory and files operations
consulting the current working directory for executables: set the environment
variable ``NoDefaultCurrentDirectoryInExePath``.

Also on Windows, the ``PATHEXT`` variable is used to resolve commands
that may not already include an extension. For example, if you call
``shutil.which("python")``, :func:`which` will search ``PATHEXT``
Also on Windows, the :envvar:`PATHEXT` environment variable is used to
resolve commands that may not already include an extension. For example,
if you call ``shutil.which("python")``, :func:`which` will search ``PATHEXT``
to know that it should look for ``python.exe`` within the *path*
directories. For example, on Windows::

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/signal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ The :mod:`signal` module defines the following functions:

See the :manpage:`pidfd_send_signal(2)` man page for more information.

.. availability:: Linux >= 5.1
.. availability:: Linux >= 5.1, Android >= :func:`build-time <sys.getandroidapilevel>` API level 31
.. versionadded:: 3.9


Expand Down
18 changes: 18 additions & 0 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,23 @@ These can be used as types in annotations. They all support subscription using
>>> X.__metadata__
('very', 'important', 'metadata')

* At runtime, if you want to retrieve the original
type wrapped by ``Annotated``, use the :attr:`!__origin__` attribute:

.. doctest::

>>> from typing import Annotated, get_origin
>>> Password = Annotated[str, "secret"]
>>> Password.__origin__
<class 'str'>

Note that using :func:`get_origin` will return ``Annotated`` itself:

.. doctest::

>>> get_origin(Password)
typing.Annotated

.. seealso::

:pep:`593` - Flexible function and variable annotations
Expand Down Expand Up @@ -3298,6 +3315,7 @@ Introspection helpers
assert get_origin(str) is None
assert get_origin(Dict[str, int]) is dict
assert get_origin(Union[int, str]) is Union
assert get_origin(Annotated[str, "metadata"]) is Annotated
P = ParamSpec('P')
assert get_origin(P.args) is P
assert get_origin(P.kwargs) is P
Expand Down
3 changes: 3 additions & 0 deletions Doc/library/warnings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,9 @@ Available Context Managers
passed to :func:`simplefilter` as if it were called immediately on
entering the context.

See :ref:`warning-filter` for the meaning of the *category* and *lineno*
parameters.

.. note::

The :class:`catch_warnings` manager works by replacing and
Expand Down
2 changes: 1 addition & 1 deletion Doc/reference/import.rst
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ the module.

It is **strongly** recommended that you rely on :attr:`__spec__` and
its attributes instead of any of the other individual attributes
listed below.
listed below, except :attr:`__name__`.

.. attribute:: __name__

Expand Down
2 changes: 1 addition & 1 deletion Doc/tools/extensions/patchlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ def get_version_info():


if __name__ == "__main__":
print(format_version_info(get_header_version_info())[1])
print(format_version_info(get_header_version_info())[0])
Loading

0 comments on commit 5bb1d1e

Please sign in to comment.