Skip to content

Commit

Permalink
Merge branch 'main' into pythongh-126688-import-lock
Browse files Browse the repository at this point in the history
  • Loading branch information
colesbury committed Nov 11, 2024
2 parents 5e86cca + 25aee21 commit 4bf74b8
Show file tree
Hide file tree
Showing 226 changed files with 5,381 additions and 2,764 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/jit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- x86_64-pc-windows-msvc/msvc
- aarch64-pc-windows-msvc/msvc
- x86_64-apple-darwin/clang
# - aarch64-apple-darwin/clang
- aarch64-apple-darwin/clang
- x86_64-unknown-linux-gnu/gcc
- x86_64-unknown-linux-gnu/clang
- aarch64-unknown-linux-gnu/gcc
Expand All @@ -79,11 +79,10 @@ jobs:
architecture: x86_64
runner: macos-13
compiler: clang
# GH-126464: A recent change to either GHA or LLVM broke this job:
# - target: aarch64-apple-darwin/clang
# architecture: aarch64
# runner: macos-14
# compiler: clang
- target: aarch64-apple-darwin/clang
architecture: aarch64
runner: macos-14
compiler: clang
- target: x86_64-unknown-linux-gnu/gcc
architecture: x86_64
runner: ubuntu-22.04
Expand Down Expand Up @@ -132,8 +131,8 @@ jobs:
brew update
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
brew install llvm@${{ matrix.llvm }}
SDKROOT="$(xcrun --show-sdk-path)" \
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
export SDKROOT="$(xcrun --show-sdk-path)"
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
make all --jobs 4
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reusable-wasi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
WASI_SDK_VERSION: 24
WASI_SDK_PATH: /opt/wasi-sdk
CROSS_BUILD_PYTHON: cross-build/build
CROSS_BUILD_WASI: cross-build/wasm32-wasi
CROSS_BUILD_WASI: cross-build/wasm32-wasip1
steps:
- uses: actions/checkout@v4
# No problem resolver registered as one doesn't currently exist for Clang.
Expand All @@ -31,7 +31,7 @@ jobs:
with:
path: ${{ env.WASI_SDK_PATH }}
key: ${{ runner.os }}-wasi-sdk-${{ env.WASI_SDK_VERSION }}
- name: "Install WASI SDK"
- name: "Install WASI SDK" # Hard-coded to x64.
if: steps.cache-wasi-sdk.outputs.cache-hit != 'true'
run: |
mkdir ${{ env.WASI_SDK_PATH }} && \
Expand Down
14 changes: 7 additions & 7 deletions Doc/c-api/typeobj.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2230,7 +2230,7 @@ This is done by filling a :c:type:`PyType_Spec` structure and calling
.. _number-structs:

Number Object Structures
========================
------------------------

.. sectionauthor:: Amaury Forgeot d'Arc

Expand Down Expand Up @@ -2344,7 +2344,7 @@ Number Object Structures
.. _mapping-structs:

Mapping Object Structures
=========================
-------------------------

.. sectionauthor:: Amaury Forgeot d'Arc

Expand Down Expand Up @@ -2381,7 +2381,7 @@ Mapping Object Structures
.. _sequence-structs:

Sequence Object Structures
==========================
--------------------------

.. sectionauthor:: Amaury Forgeot d'Arc

Expand Down Expand Up @@ -2461,7 +2461,7 @@ Sequence Object Structures
.. _buffer-structs:

Buffer Object Structures
========================
------------------------

.. sectionauthor:: Greg J. Stein <greg@lyra.org>
.. sectionauthor:: Benjamin Peterson
Expand Down Expand Up @@ -2556,7 +2556,7 @@ Buffer Object Structures


Async Object Structures
=======================
-----------------------

.. sectionauthor:: Yury Selivanov <yselivanov@sprymix.com>

Expand Down Expand Up @@ -2624,7 +2624,7 @@ Async Object Structures
.. _slot-typedefs:

Slot Type typedefs
==================
------------------

.. c:type:: PyObject *(*allocfunc)(PyTypeObject *cls, Py_ssize_t nitems)
Expand Down Expand Up @@ -2733,7 +2733,7 @@ Slot Type typedefs
.. _typedef-examples:

Examples
========
--------

The following are simple examples of Python type definitions. They
include common usage you may encounter. Some demonstrate tricky corner
Expand Down
7 changes: 0 additions & 7 deletions Doc/deprecations/pending-removal-in-3.14.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
Pending removal in Python 3.14
------------------------------

* The import system:

* Setting :attr:`~module.__loader__` on a module while
failing to set :attr:`__spec__.loader <importlib.machinery.ModuleSpec.loader>`
is deprecated. In Python 3.14, :attr:`!__loader__` will cease to be set or
taken into consideration by the import system or the standard library.

* :mod:`argparse`: The *type*, *choices*, and *metavar* parameters
of :class:`!argparse.BooleanOptionalAction` are deprecated
and will be removed in 3.14.
Expand Down
7 changes: 7 additions & 0 deletions Doc/deprecations/pending-removal-in-3.16.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Pending removal in Python 3.16
------------------------------

* The import system:

* Setting :attr:`~module.__loader__` on a module while
failing to set :attr:`__spec__.loader <importlib.machinery.ModuleSpec.loader>`
is deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or
taken into consideration by the import system or the standard library.

* :mod:`array`:

* The ``'u'`` format code (:c:type:`wchar_t`)
Expand Down
7 changes: 2 additions & 5 deletions Doc/howto/logging-cookbook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1267,11 +1267,8 @@ to adapt in your own applications.

You could also write your own handler which uses the :class:`~multiprocessing.Lock`
class from the :mod:`multiprocessing` module to serialize access to the
file from your processes. The existing :class:`FileHandler` and subclasses do
not make use of :mod:`multiprocessing` at present, though they may do so in the
future. Note that at present, the :mod:`multiprocessing` module does not provide
working lock functionality on all platforms (see
https://bugs.python.org/issue3770).
file from your processes. The stdlib :class:`FileHandler` and subclasses do
not make use of :mod:`multiprocessing`.

.. currentmodule:: logging.handlers

Expand Down
26 changes: 23 additions & 3 deletions Doc/library/getopt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ exception:
be parsed, without the leading reference to the running program. Typically, this
means ``sys.argv[1:]``. *shortopts* is the string of option letters that the
script wants to recognize, with options that require an argument followed by a
colon (``':'``; i.e., the same format that Unix :c:func:`!getopt` uses).
colon (``':'``) and options that accept an optional argument followed by
two colons (``'::'``); i.e., the same format that Unix :c:func:`!getopt` uses.

.. note::

Expand All @@ -49,8 +50,10 @@ exception:
*longopts*, if specified, must be a list of strings with the names of the
long options which should be supported. The leading ``'--'`` characters
should not be included in the option name. Long options which require an
argument should be followed by an equal sign (``'='``). Optional arguments
are not supported. To accept only long options, *shortopts* should be an
argument should be followed by an equal sign (``'='``).
Long options which accept an optional argument should be followed by
an equal sign and question mark (``'=?'``).
To accept only long options, *shortopts* should be an
empty string. Long options on the command line can be recognized so long as
they provide a prefix of the option name that matches exactly one of the
accepted options. For example, if *longopts* is ``['foo', 'frob']``, the
Expand All @@ -67,6 +70,9 @@ exception:
options occur in the list in the same order in which they were found, thus
allowing multiple occurrences. Long and short options may be mixed.

.. versionchanged:: 3.14
Optional arguments are supported.


.. function:: gnu_getopt(args, shortopts, longopts=[])

Expand Down Expand Up @@ -124,6 +130,20 @@ Using long option names is equally easy:
>>> args
['a1', 'a2']

Optional arguments should be specified explicitly:

.. doctest::

>>> s = '-Con -C --color=off --color a1 a2'
>>> args = s.split()
>>> args
['-Con', '-C', '--color=off', '--color', 'a1', 'a2']
>>> optlist, args = getopt.getopt(args, 'C::', ['color=?'])
>>> optlist
[('-C', 'on'), ('-C', ''), ('--color', 'off'), ('--color', '')]
>>> args
['a1', 'a2']

In a script, typical usage is something like this:

.. testcode::
Expand Down
3 changes: 1 addition & 2 deletions Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4577,8 +4577,7 @@ written in Python, such as a mail server's external command delivery program.
only be sent to console processes which share a common console window,
e.g., some subprocesses. Any other value for *sig* will cause the process
to be unconditionally killed by the TerminateProcess API, and the exit code
will be set to *sig*. The Windows version of :func:`kill` additionally takes
process handles to be killed.
will be set to *sig*.

See also :func:`signal.pthread_kill`.

Expand Down
22 changes: 11 additions & 11 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1726,11 +1726,11 @@ without the dedicated syntax, as documented below.
class Sequence[T]: # T is a TypeVar
...

This syntax can also be used to create bound and constrained type
This syntax can also be used to create bounded and constrained type
variables::

class StrSequence[S: str]: # S is a TypeVar bound to str
...
class StrSequence[S: str]: # S is a TypeVar with a `str` upper bound;
... # we can say that S is "bounded by `str`"


class StrOrBytesSequence[A: (str, bytes)]: # A is a TypeVar constrained to str or bytes
Expand Down Expand Up @@ -1763,8 +1763,8 @@ without the dedicated syntax, as documented below.
"""Add two strings or bytes objects together."""
return x + y

Note that type variables can be *bound*, *constrained*, or neither, but
cannot be both bound *and* constrained.
Note that type variables can be *bounded*, *constrained*, or neither, but
cannot be both bounded *and* constrained.

The variance of type variables is inferred by type checkers when they are created
through the :ref:`type parameter syntax <type-params>` or when
Expand All @@ -1774,8 +1774,8 @@ without the dedicated syntax, as documented below.
By default, manually created type variables are invariant.
See :pep:`484` and :pep:`695` for more details.

Bound type variables and constrained type variables have different
semantics in several important ways. Using a *bound* type variable means
Bounded type variables and constrained type variables have different
semantics in several important ways. Using a *bounded* type variable means
that the ``TypeVar`` will be solved using the most specific type possible::

x = print_capitalized('a string')
Expand All @@ -1789,8 +1789,8 @@ without the dedicated syntax, as documented below.

z = print_capitalized(45) # error: int is not a subtype of str

Type variables can be bound to concrete types, abstract types (ABCs or
protocols), and even unions of types::
The upper bound of a type variable can be a concrete type, abstract type
(ABC or Protocol), or even a union of types::

# Can be anything with an __abs__ method
def print_abs[T: SupportsAbs](arg: T) -> None:
Expand Down Expand Up @@ -1834,7 +1834,7 @@ without the dedicated syntax, as documented below.

.. attribute:: __bound__

The bound of the type variable, if any.
The upper bound of the type variable, if any.

.. versionchanged:: 3.12

Expand Down Expand Up @@ -2100,7 +2100,7 @@ without the dedicated syntax, as documented below.
return x + y

Without ``ParamSpec``, the simplest way to annotate this previously was to
use a :class:`TypeVar` with bound ``Callable[..., Any]``. However this
use a :class:`TypeVar` with upper bound ``Callable[..., Any]``. However this
causes two problems:

1. The type checker can't type check the ``inner`` function because
Expand Down
7 changes: 2 additions & 5 deletions Doc/reference/compound_stmts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -534,18 +534,15 @@ is semantically equivalent to::
enter = type(manager).__enter__
exit = type(manager).__exit__
value = enter(manager)
hit_except = False

try:
TARGET = value
SUITE
except:
hit_except = True
if not exit(manager, *sys.exc_info()):
raise
finally:
if not hit_except:
exit(manager, None, None, None)
else:
exit(manager, None, None, None)

With more than one item, the context managers are processed as if multiple
:keyword:`with` statements were nested::
Expand Down
4 changes: 2 additions & 2 deletions Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1028,9 +1028,9 @@ this approach.
using the :class:`types.ModuleType` constructor.
Previously the attribute was optional.

.. deprecated-removed:: 3.12 3.14
.. deprecated-removed:: 3.12 3.16
Setting :attr:`!__loader__` on a module while failing to set
:attr:`!__spec__.loader` is deprecated. In Python 3.14,
:attr:`!__spec__.loader` is deprecated. In Python 3.16,
:attr:`!__loader__` will cease to be set or taken into consideration by
the import system or the standard library.

Expand Down
13 changes: 13 additions & 0 deletions Doc/using/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,19 @@ General Options

.. versionadded:: 3.13

.. option:: --enable-experimental-jit=[no|yes|yes-off|interpreter]

Indicate how to integrate the :ref:`JIT compiler <whatsnew313-jit-compiler>`.

* ``no`` - build the interpreter without the JIT.
* ``yes`` - build the interpreter with the JIT.
* ``yes-off`` - build the interpreter with the JIT but disable it by default.
* ``interpreter`` - build the interpreter without the JIT, but with the tier 2 enabled interpreter.

By convention, ``--enable-experimental-jit`` is a shorthand for ``--enable-experimental-jit=yes``.

.. versionadded:: 3.13

.. option:: PKG_CONFIG

Path to ``pkg-config`` utility.
Expand Down
5 changes: 5 additions & 0 deletions Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,11 @@ functools
to reserve a place for positional arguments.
(Contributed by Dominykas Grigonis in :gh:`119127`.)

getopt
------

* Add support for options with optional arguments.
(Contributed by Serhiy Storchaka in :gh:`126374`.)

http
----
Expand Down
2 changes: 1 addition & 1 deletion Doc/whatsnew/3.8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ Add option ``--json-lines`` to parse every input line as a separate JSON object.
logging
-------

Added a *force* keyword argument to :func:`logging.basicConfig`
Added a *force* keyword argument to :func:`logging.basicConfig`.
When set to true, any existing handlers attached
to the root logger are removed and closed before carrying out the
configuration specified by the other arguments.
Expand Down
Loading

0 comments on commit 4bf74b8

Please sign in to comment.