Skip to content

Commit

Permalink
Merge branch 'main' into pythongh-114271-remove-tstate_lock
Browse files Browse the repository at this point in the history
  • Loading branch information
mpage committed Mar 11, 2024
2 parents a7095e4 + 44f9a84 commit ccd1c2e
Show file tree
Hide file tree
Showing 120 changed files with 2,181 additions and 812 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,14 @@ jobs:
- name: SSL tests
run: ./python Lib/test/ssltests.py

build_wasi:
name: 'WASI'
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
uses: ./.github/workflows/reusable-wasi.yml
with:
config_hash: ${{ needs.check_source.outputs.config_hash }}

test_hypothesis:
name: "Hypothesis tests on Ubuntu"
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -525,6 +533,7 @@ jobs:
- build_ubuntu
- build_ubuntu_free_threading
- build_ubuntu_ssltests
- build_wasi
- build_windows
- build_windows_free_threading
- test_hypothesis
Expand Down Expand Up @@ -558,6 +567,7 @@ jobs:
build_ubuntu,
build_ubuntu_free_threading,
build_ubuntu_ssltests,
build_wasi,
build_windows,
build_windows_free_threading,
build_asan,
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/reusable-wasi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
on:
workflow_call:
inputs:
config_hash:
required: true
type: string

jobs:
build_wasi_reusable:
name: 'build and test'
timeout-minutes: 60
runs-on: ubuntu-20.04
env:
WASMTIME_VERSION: 18.0.2
WASI_SDK_VERSION: 20
WASI_SDK_PATH: /opt/wasi-sdk
CROSS_BUILD_PYTHON: cross-build/build
CROSS_BUILD_WASI: cross-build/wasm32-wasi
steps:
- uses: actions/checkout@v4
# No problem resolver registered as one doesn't currently exist for Clang.
- name: "Install wasmtime"
uses: jcbhmr/setup-wasmtime@v2
with:
wasmtime-version: ${{ env.WASMTIME_VERSION }}
- name: "Restore WASI SDK"
id: cache-wasi-sdk
uses: actions/cache@v4
with:
path: ${{ env.WASI_SDK_PATH }}
key: ${{ runner.os }}-wasi-sdk-${{ env.WASI_SDK_VERSION }}
- name: "Install WASI SDK"
if: steps.cache-wasi-sdk.outputs.cache-hit != 'true'
run: |
mkdir ${{ env.WASI_SDK_PATH }} && \
curl -s -S --location https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${{ env.WASI_SDK_VERSION }}/wasi-sdk-${{ env.WASI_SDK_VERSION }}.0-linux.tar.gz | \
tar --strip-components 1 --directory ${{ env.WASI_SDK_PATH }} --extract --gunzip
- name: "Configure ccache action"
uses: hendrikmuhs/[email protected]
with:
save: ${{ github.event_name == 'push' }}
max-size: "200M"
- name: "Add ccache to PATH"
run: echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
- name: "Install Python"
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: "Restore Python build config.cache"
uses: actions/cache@v4
with:
path: ${{ env.CROSS_BUILD_PYTHON }}/config.cache
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
- name: "Configure build Python"
run: python3 Tools/wasm/wasi.py configure-build-python -- --config-cache --with-pydebug
- name: "Make build Python"
run: python3 Tools/wasm/wasi.py make-build-python
- name: "Restore host config.cache"
uses: actions/cache@v4
with:
path: ${{ env.CROSS_BUILD_WASI }}/config.cache
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-wasi-sdk-${{ env.WASI_SDK_VERSION }}-${{ inputs.config_hash }}
- name: "Configure host"
# `--with-pydebug` inferred from configure-build-python
run: python3 Tools/wasm/wasi.py configure-host -- --config-cache
- name: "Make host"
run: python3 Tools/wasm/wasi.py make-host
- name: "Display build info"
run: make --directory ${{ env.CROSS_BUILD_WASI }} pythoninfo
- name: "Test"
run: make --directory ${{ env.CROSS_BUILD_WASI }} test
25 changes: 24 additions & 1 deletion Doc/c-api/hash.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
PyHash API
----------

See also the :c:member:`PyTypeObject.tp_hash` member.
See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`.

.. c:type:: Py_hash_t
Expand All @@ -17,6 +17,29 @@ See also the :c:member:`PyTypeObject.tp_hash` member.

.. versionadded:: 3.2

.. c:macro:: PyHASH_MODULUS
The `Mersenne prime <https://en.wikipedia.org/wiki/Mersenne_prime>`_ ``P = 2**n -1``, used for numeric hash scheme.

.. versionadded:: 3.13

.. c:macro:: PyHASH_BITS
The exponent ``n`` of ``P`` in :c:macro:`PyHASH_MODULUS`.

.. versionadded:: 3.13

.. c:macro:: PyHASH_INF
The hash value returned for a positive infinity.

.. versionadded:: 3.13

.. c:macro:: PyHASH_IMAG
The multiplier used for the imaginary part of a complex number.

.. versionadded:: 3.13

.. c:type:: PyHash_FuncDef
Expand Down
25 changes: 25 additions & 0 deletions Doc/library/asyncio-eventloop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1641,6 +1641,31 @@ Do not instantiate the :class:`Server` class directly.
coroutine to wait until the server is closed (and no more
connections are active).

.. method:: close_clients()

Close all existing incoming client connections.

Calls :meth:`~asyncio.BaseTransport.close` on all associated
transports.

:meth:`close` should be called before :meth:`close_clients` when
closing the server to avoid races with new clients connecting.

.. versionadded:: 3.13

.. method:: abort_clients()

Close all existing incoming client connections immediately,
without waiting for pending operations to complete.

Calls :meth:`~asyncio.WriteTransport.abort` on all associated
transports.

:meth:`close` should be called before :meth:`abort_clients` when
closing the server to avoid races with new clients connecting.

.. versionadded:: 3.13

.. method:: get_loop()

Return the event loop associated with the server object.
Expand Down
4 changes: 2 additions & 2 deletions Doc/library/dataclasses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ Using dataclasses, *if* this code was valid::
class D:
x: list = [] # This code raises ValueError
def add(self, element):
self.x += element
self.x.append(element)

it would generate code similar to::

Expand All @@ -728,7 +728,7 @@ it would generate code similar to::
def __init__(self, x=x):
self.x = x
def add(self, element):
self.x += element
self.x.append(element)

assert D().x is D().x

Expand Down
7 changes: 7 additions & 0 deletions Doc/library/enum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,20 @@ Data Types
>>> Color.RED.value
1

Value of the member, can be set in :meth:`~object.__new__`.

.. note:: Enum member values

Member values can be anything: :class:`int`, :class:`str`, etc. If
the exact value is unimportant you may use :class:`auto` instances and an
appropriate value will be chosen for you. See :class:`auto` for the
details.

While mutable/unhashable values, such as :class:`dict`, :class:`list` or
a mutable :class:`~dataclasses.dataclass`, can be used, they will have a
quadratic performance impact during creation relative to the
total number of mutable/unhashable values in the enum.

.. attribute:: Enum._name_

Name of the member.
Expand Down
2 changes: 2 additions & 0 deletions Doc/library/resource.rst
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ platform.

The largest area of mapped memory which the process may occupy.

.. availability:: FreeBSD >= 11.


.. data:: RLIMIT_AS

Expand Down
45 changes: 20 additions & 25 deletions Doc/library/sys.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1367,47 +1367,42 @@ always available.

.. data:: platform

This string contains a platform identifier that can be used to append
platform-specific components to :data:`sys.path`, for instance.

For Unix systems, except on Linux and AIX, this is the lowercased OS name as
returned by ``uname -s`` with the first part of the version as returned by
``uname -r`` appended, e.g. ``'sunos5'`` or ``'freebsd8'``, *at the time
when Python was built*. Unless you want to test for a specific system
version, it is therefore recommended to use the following idiom::

if sys.platform.startswith('freebsd'):
# FreeBSD-specific code here...
elif sys.platform.startswith('linux'):
# Linux-specific code here...
elif sys.platform.startswith('aix'):
# AIX-specific code here...

For other systems, the values are:
A string containing a platform identifier. Known values are:

================ ===========================
System ``platform`` value
================ ===========================
AIX ``'aix'``
Android ``'android'``
Emscripten ``'emscripten'``
iOS ``'ios'``
Linux ``'linux'``
WASI ``'wasi'``
macOS ``'darwin'``
Windows ``'win32'``
Windows/Cygwin ``'cygwin'``
macOS ``'darwin'``
WASI ``'wasi'``
================ ===========================

On Unix systems not listed in the table, the value is the lowercased OS name
as returned by ``uname -s``, with the first part of the version as returned by
``uname -r`` appended, e.g. ``'sunos5'`` or ``'freebsd8'``, *at the time
when Python was built*. Unless you want to test for a specific system
version, it is therefore recommended to use the following idiom::

if sys.platform.startswith('freebsd'):
# FreeBSD-specific code here...

.. versionchanged:: 3.3
On Linux, :data:`sys.platform` doesn't contain the major version anymore.
It is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``. Since
older Python versions include the version number, it is recommended to
always use the ``startswith`` idiom presented above.
It is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``.

.. versionchanged:: 3.8
On AIX, :data:`sys.platform` doesn't contain the major version anymore.
It is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``. Since
older Python versions include the version number, it is recommended to
always use the ``startswith`` idiom presented above.
It is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``.

.. versionchanged:: 3.13
On Android, :data:`sys.platform` now returns ``'android'`` rather than
``'linux'``.

.. seealso::

Expand Down
Loading

0 comments on commit ccd1c2e

Please sign in to comment.