Skip to content

Commit

Permalink
Merge branch 'main' into pythongh-127133
Browse files Browse the repository at this point in the history
  • Loading branch information
savannahostrowski authored Nov 23, 2024
2 parents 76aadc6 + a13e94d commit 17556c0
Show file tree
Hide file tree
Showing 64 changed files with 1,360 additions and 592 deletions.
10 changes: 10 additions & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
self-hosted-runner:
labels: ["ubuntu-24.04-aarch64", "windows-aarch64"]

config-variables: null

paths:
.github/workflows/**/*.yml:
ignore:
- 1st argument of function call is not assignable
- SC2(015|038|086|091|097|098|129|155)
22 changes: 17 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,28 @@ jobs:
needs: check_source
if: fromJSON(needs.check_source.outputs.run_tests)
strategy:
fail-fast: false
matrix:
os:
- windows-latest
arch:
- Win32
- x64
- arm64
- x64
free-threading:
- false
- true
- false
- true
include:
- os: windows-latest # FIXME(diegorusso): change to os: windows-aarch64
arch: arm64
free-threading: false
- os: windows-latest # FIXME(diegorusso): change to os: windows-aarch64
arch: arm64
free-threading: true
- os: windows-latest
arch: Win32
free-threading: false
uses: ./.github/workflows/reusable-windows.yml
with:
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}
free-threading: ${{ matrix.free-threading }}

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/reusable-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04]
os: [ubuntu-24.04, ubuntu-24.04-aarch64]
env:
FORCE_COLOR: 1
OPENSSL_VER: 3.0.15
Expand Down Expand Up @@ -82,11 +82,11 @@ jobs:
- name: Build CPython out-of-tree
if: ${{ inputs.free-threading }}
working-directory: ${{ env.CPYTHON_BUILDDIR }}
run: make -j4
run: make -j
- name: Build CPython out-of-tree (for compiler warning check)
if: ${{ !inputs.free-threading}}
working-directory: ${{ env.CPYTHON_BUILDDIR }}
run: set -o pipefail; make -j4 --output-sync 2>&1 | tee compiler_output_ubuntu.txt
run: set -o pipefail; make -j --output-sync 2>&1 | tee compiler_output_ubuntu.txt
- name: Display build info
working-directory: ${{ env.CPYTHON_BUILDDIR }}
run: make pythoninfo
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/reusable-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Reusable Windows
on:
workflow_call:
inputs:
os:
description: OS to run on
required: true
type: string
arch:
description: CPU architecture
required: true
Expand All @@ -19,10 +23,8 @@ env:
jobs:
build:
name: >-
build${{ inputs.arch != 'arm64' && ' and test' || '' }}
(${{ inputs.arch }})
runs-on: windows-latest
name: 'build and test (${{ inputs.arch }})'
runs-on: ${{ inputs.os }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
Expand All @@ -31,17 +33,17 @@ jobs:
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Build CPython
run: >-
.\PCbuild\build.bat
.\\PCbuild\\build.bat
-e -d -v
-p ${{ inputs.arch }}
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
- name: Display build info
- name: Display build info # FIXME(diegorusso): remove the `if`
if: inputs.arch != 'arm64'
run: .\python.bat -m test.pythoninfo
- name: Tests
run: .\\python.bat -m test.pythoninfo
- name: Tests # FIXME(diegorusso): remove the `if`
if: inputs.arch != 'arm64'
run: >-
.\PCbuild\rt.bat
.\\PCbuild\\rt.bat
-p ${{ inputs.arch }}
-d -q --fast-ci
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
6 changes: 1 addition & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,9 @@ repos:
- id: check-github-workflows

- repo: https://github.com/rhysd/actionlint
rev: v1.7.3
rev: v1.7.4
hooks:
- id: actionlint
args: [
-ignore=1st argument of function call is not assignable,
-ignore=SC2(015|038|086|091|097|098|129|155),
]

- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v1.0.0
Expand Down
18 changes: 18 additions & 0 deletions Doc/library/argparse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ arguments it contains. The default message can be overridden with the
The ``%(prog)s`` format specifier is available to fill in the program name in
your usage messages.

When a custom usage message is specified for the main parser, you may also want to
consider passing the ``prog`` argument to :meth:`~ArgumentParser.add_subparsers`
or the ``prog`` and the ``usage`` arguments to
:meth:`~_SubParsersAction.add_parser`, to ensure consistent command prefixes and
usage information across subparsers.


.. _description:

Expand Down Expand Up @@ -583,6 +589,14 @@ are strings::
>>> parser.parse_args(['--action', 'sumn', 1, 2, 3])
tester.py: error: argument --action: invalid choice: 'sumn', maybe you meant 'sum'? (choose from 'sum', 'max')

If you're writing code that needs to be compatible with older Python versions
and want to opportunistically use ``suggest_on_error`` when it's available, you
can set it as an attribute after initializing the parser instead of using the
keyword argument::

>>> parser = argparse.ArgumentParser(description='Process some integers.')
>>> parser.suggest_on_error = True

.. versionadded:: 3.14


Expand Down Expand Up @@ -1810,6 +1824,10 @@ Sub-commands
.. versionchanged:: 3.7
New *required* keyword-only parameter.

.. versionchanged:: 3.14
Subparser's *prog* is no longer affected by a custom usage message in
the main parser.


FileType objects
^^^^^^^^^^^^^^^^
Expand Down
63 changes: 48 additions & 15 deletions Doc/library/ctypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1413,13 +1413,15 @@ way is to instantiate one of the following classes:

.. class:: OleDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=None)

Windows only: Instances of this class represent loaded shared libraries,
Instances of this class represent loaded shared libraries,
functions in these libraries use the ``stdcall`` calling convention, and are
assumed to return the windows specific :class:`HRESULT` code. :class:`HRESULT`
values contain information specifying whether the function call failed or
succeeded, together with additional error code. If the return value signals a
failure, an :class:`OSError` is automatically raised.

.. availability:: Windows

.. versionchanged:: 3.3
:exc:`WindowsError` used to be raised,
which is now an alias of :exc:`OSError`.
Expand All @@ -1431,14 +1433,17 @@ way is to instantiate one of the following classes:

.. class:: WinDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=None)

Windows only: Instances of this class represent loaded shared libraries,
Instances of this class represent loaded shared libraries,
functions in these libraries use the ``stdcall`` calling convention, and are
assumed to return :c:expr:`int` by default.

.. availability:: Windows

.. versionchanged:: 3.12

The *name* parameter can now be a :term:`path-like object`.


The Python :term:`global interpreter lock` is released before calling any
function exported by these libraries, and reacquired afterwards.

Expand Down Expand Up @@ -1574,13 +1579,17 @@ These prefabricated library loaders are available:
.. data:: windll
:noindex:

Windows only: Creates :class:`WinDLL` instances.
Creates :class:`WinDLL` instances.

.. availability:: Windows


.. data:: oledll
:noindex:

Windows only: Creates :class:`OleDLL` instances.
Creates :class:`OleDLL` instances.

.. availability:: Windows


.. data:: pydll
Expand Down Expand Up @@ -1746,11 +1755,13 @@ See :ref:`ctypes-callback-functions` for examples.

.. function:: WINFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False)

Windows only: The returned function prototype creates functions that use the
The returned function prototype creates functions that use the
``stdcall`` calling convention. The function will
release the GIL during the call. *use_errno* and *use_last_error* have the
same meaning as above.

.. availability:: Windows


.. function:: PYFUNCTYPE(restype, *argtypes)

Expand Down Expand Up @@ -1981,17 +1992,21 @@ Utility functions

.. function:: DllCanUnloadNow()

Windows only: This function is a hook which allows implementing in-process
This function is a hook which allows implementing in-process
COM servers with ctypes. It is called from the DllCanUnloadNow function that
the _ctypes extension dll exports.

.. availability:: Windows


.. function:: DllGetClassObject()

Windows only: This function is a hook which allows implementing in-process
This function is a hook which allows implementing in-process
COM servers with ctypes. It is called from the DllGetClassObject function
that the ``_ctypes`` extension dll exports.

.. availability:: Windows


.. function:: find_library(name)
:module: ctypes.util
Expand All @@ -2007,28 +2022,35 @@ Utility functions
.. function:: find_msvcrt()
:module: ctypes.util

Windows only: return the filename of the VC runtime library used by Python,
Returns the filename of the VC runtime library used by Python,
and by the extension modules. If the name of the library cannot be
determined, ``None`` is returned.

If you need to free memory, for example, allocated by an extension module
with a call to the ``free(void *)``, it is important that you use the
function in the same library that allocated the memory.

.. availability:: Windows


.. function:: FormatError([code])

Windows only: Returns a textual description of the error code *code*. If no
Returns a textual description of the error code *code*. If no
error code is specified, the last error code is used by calling the Windows
api function GetLastError.

.. availability:: Windows


.. function:: GetLastError()

Windows only: Returns the last error code set by Windows in the calling thread.
Returns the last error code set by Windows in the calling thread.
This function calls the Windows ``GetLastError()`` function directly,
it does not return the ctypes-private copy of the error code.

.. availability:: Windows


.. function:: get_errno()

Returns the current value of the ctypes-private copy of the system
Expand All @@ -2038,11 +2060,14 @@ Utility functions

.. function:: get_last_error()

Windows only: returns the current value of the ctypes-private copy of the system
Returns the current value of the ctypes-private copy of the system
:data:`!LastError` variable in the calling thread.

.. availability:: Windows

.. audit-event:: ctypes.get_last_error "" ctypes.get_last_error


.. function:: memmove(dst, src, count)

Same as the standard C memmove library function: copies *count* bytes from
Expand Down Expand Up @@ -2091,10 +2116,12 @@ Utility functions

.. function:: set_last_error(value)

Windows only: set the current value of the ctypes-private copy of the system
Sets the current value of the ctypes-private copy of the system
:data:`!LastError` variable in the calling thread to *value* and return the
previous value.

.. availability:: Windows

.. audit-event:: ctypes.set_last_error error ctypes.set_last_error


Expand All @@ -2115,12 +2142,14 @@ Utility functions

.. function:: WinError(code=None, descr=None)

Windows only: this function is probably the worst-named thing in ctypes. It
This function is probably the worst-named thing in ctypes. It
creates an instance of :exc:`OSError`. If *code* is not specified,
``GetLastError`` is called to determine the error code. If *descr* is not
specified, :func:`FormatError` is called to get a textual description of the
error.

.. availability:: Windows

.. versionchanged:: 3.3
An instance of :exc:`WindowsError` used to be created, which is now an
alias of :exc:`OSError`.
Expand Down Expand Up @@ -2484,9 +2513,11 @@ These are the fundamental ctypes data types:

.. class:: HRESULT

Windows only: Represents a :c:type:`!HRESULT` value, which contains success or
Represents a :c:type:`!HRESULT` value, which contains success or
error information for a function or method call.

.. availability:: Windows


.. class:: py_object

Expand Down Expand Up @@ -2755,7 +2786,7 @@ Exceptions

.. exception:: COMError(hresult, text, details)

Windows only: This exception is raised when a COM method call failed.
This exception is raised when a COM method call failed.

.. attribute:: hresult

Expand All @@ -2775,4 +2806,6 @@ Exceptions
identifier. *progid* is the ``ProgID`` of the interface that defined the
error.

.. availability:: Windows

.. versionadded:: next
2 changes: 1 addition & 1 deletion Doc/library/importlib.metadata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ Entry points

Details of a collection of installed entry points.

Also provides a ``.groups`` attribute that reports all identifed entry
Also provides a ``.groups`` attribute that reports all identified entry
point groups, and a ``.names`` attribute that reports all identified entry
point names.

Expand Down
Loading

0 comments on commit 17556c0

Please sign in to comment.