Skip to content

Commit fa79bd8

Browse files
Merge branch 'main' into autoconf271
2 parents c29d98e + bfd20d2 commit fa79bd8

76 files changed

Lines changed: 1999 additions & 3307 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ permissions:
2828
contents: read
2929

3030
concurrency:
31-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
31+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-reusable
3232
cancel-in-progress: true
3333

3434
jobs:
@@ -37,8 +37,10 @@ jobs:
3737
runs-on: ubuntu-latest
3838
timeout-minutes: 10
3939
outputs:
40+
run-docs: ${{ steps.docs-changes.outputs.run-docs || false }}
4041
run_tests: ${{ steps.check.outputs.run_tests }}
4142
run_hypothesis: ${{ steps.check.outputs.run_hypothesis }}
43+
config_hash: ${{ steps.config_hash.outputs.hash }}
4244
steps:
4345
- uses: actions/checkout@v3
4446
- name: Check for source changes
@@ -74,6 +76,32 @@ jobs:
7476
echo "Run hypothesis tests"
7577
echo "run_hypothesis=true" >> $GITHUB_OUTPUT
7678
fi
79+
- name: Compute hash for config cache key
80+
id: config_hash
81+
run: |
82+
echo "hash=${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}" >> $GITHUB_OUTPUT
83+
- name: Get a list of the changed documentation-related files
84+
if: github.event_name == 'pull_request'
85+
id: changed-docs-files
86+
uses: Ana06/get-changed-files@v2.2.0
87+
with:
88+
filter: |
89+
Doc/**
90+
Misc/**
91+
.github/workflows/reusable-docs.yml
92+
- name: Check for docs changes
93+
if: >-
94+
github.event_name == 'pull_request'
95+
&& steps.changed-docs-files.outputs.added_modified_renamed != ''
96+
id: docs-changes
97+
run: |
98+
echo "run-docs=true" >> "${GITHUB_OUTPUT}"
99+
100+
check-docs:
101+
name: Docs
102+
needs: check_source
103+
if: fromJSON(needs.check_source.outputs.run-docs)
104+
uses: ./.github/workflows/reusable-docs.yml
77105

78106
check_generated_files:
79107
name: 'Check if generated files are up to date'
@@ -87,7 +115,7 @@ jobs:
87115
uses: actions/cache@v3
88116
with:
89117
path: config.cache
90-
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
118+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
91119
- uses: actions/setup-python@v3
92120
- name: Install Dependencies
93121
run: sudo ./.github/workflows/posix-deps-apt.sh
@@ -189,7 +217,7 @@ jobs:
189217
uses: actions/cache@v3
190218
with:
191219
path: config.cache
192-
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
220+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
193221
- name: Install Homebrew dependencies
194222
run: brew install pkg-config openssl@1.1 xz gdbm tcl-tk
195223
- name: Configure CPython
@@ -255,7 +283,7 @@ jobs:
255283
uses: actions/cache@v3
256284
with:
257285
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
258-
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
286+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
259287
- name: Configure CPython out-of-tree
260288
working-directory: ${{ env.CPYTHON_BUILDDIR }}
261289
run: |
@@ -297,7 +325,7 @@ jobs:
297325
uses: actions/cache@v3
298326
with:
299327
path: config.cache
300-
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
328+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
301329
- name: Register gcc problem matcher
302330
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
303331
- name: Install Dependencies
@@ -376,7 +404,7 @@ jobs:
376404
uses: actions/cache@v3
377405
with:
378406
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
379-
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
407+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
380408
- name: Configure CPython out-of-tree
381409
working-directory: ${{ env.CPYTHON_BUILDDIR }}
382410
run: |
@@ -455,7 +483,7 @@ jobs:
455483
uses: actions/cache@v3
456484
with:
457485
path: config.cache
458-
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
486+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
459487
- name: Register gcc problem matcher
460488
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
461489
- name: Install Dependencies
Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,8 @@
11
name: Docs
22

33
on:
4+
workflow_call:
45
workflow_dispatch:
5-
#push:
6-
# branches:
7-
# - 'main'
8-
# - '3.12'
9-
# - '3.11'
10-
# - '3.10'
11-
# - '3.9'
12-
# - '3.8'
13-
# - '3.7'
14-
# paths:
15-
# - 'Doc/**'
16-
pull_request:
17-
branches:
18-
- 'main'
19-
- '3.12'
20-
- '3.11'
21-
- '3.10'
22-
- '3.9'
23-
- '3.8'
24-
- '3.7'
25-
paths:
26-
- 'Doc/**'
27-
- 'Misc/**'
28-
- '.github/workflows/doc.yml'
296

307
permissions:
318
contents: read

Doc/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@
235235
# match any of the following regexes (using re.match).
236236
coverage_ignore_modules = [
237237
r'[T|t][k|K]',
238-
r'Tix',
239238
]
240239

241240
coverage_ignore_functions = [

Doc/faq/gui.rst

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,8 @@ One solution is to ship the application with the Tcl and Tk libraries, and point
4646
to them at run-time using the :envvar:`TCL_LIBRARY` and :envvar:`TK_LIBRARY`
4747
environment variables.
4848

49-
To get truly stand-alone applications, the Tcl scripts that form the library
50-
have to be integrated into the application as well. One tool supporting that is
51-
SAM (stand-alone modules), which is part of the Tix distribution
52-
(https://tix.sourceforge.net/).
53-
54-
Build Tix with SAM enabled, perform the appropriate call to
55-
:c:func:`Tclsam_init`, etc. inside Python's
56-
:file:`Modules/tkappinit.c`, and link with libtclsam and libtksam (you
57-
might include the Tix libraries as well).
49+
Various third-party freeze libraries such as py2exe and cx_Freeze have
50+
handling for Tkinter applications built-in.
5851

5952

6053
Can I have Tk events handled while waiting for I/O?

Doc/library/ast.rst

Lines changed: 102 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ Expressions
481481
Comparison operator tokens.
482482

483483

484-
.. class:: Call(func, args, keywords, starargs, kwargs)
484+
.. class:: Call(func, args, keywords)
485485

486486
A function call. ``func`` is the function, which will often be a
487487
:class:`Name` or :class:`Attribute` object. Of the arguments:
@@ -491,7 +491,7 @@ Expressions
491491
arguments passed by keyword.
492492

493493
When creating a ``Call`` node, ``args`` and ``keywords`` are required, but
494-
they can be empty lists. ``starargs`` and ``kwargs`` are optional.
494+
they can be empty lists.
495495

496496
.. doctest::
497497

@@ -917,6 +917,25 @@ Statements
917917
type_ignores=[])
918918

919919

920+
.. class:: TypeAlias(name, type_params, value)
921+
922+
A :ref:`type alias <type-aliases>` created through the :keyword:`type`
923+
statement. ``name`` is the name of the alias, ``type_params`` is a list of
924+
:ref:`type parameters <ast-type-params>`, and ``value`` is the value of the
925+
type alias.
926+
927+
.. doctest::
928+
929+
>>> print(ast.dump(ast.parse('type Alias = int'), indent=4))
930+
Module(
931+
body=[
932+
TypeAlias(
933+
name=Name(id='Alias', ctx=Store()),
934+
type_params=[],
935+
value=Name(id='int', ctx=Load()))],
936+
type_ignores=[])
937+
938+
920939
Other statements which are only applicable inside functions or loops are
921940
described in other sections.
922941

@@ -1644,15 +1663,93 @@ Pattern matching
16441663
value=Constant(value=Ellipsis))])])],
16451664
type_ignores=[])
16461665

1666+
.. _ast-type-params:
1667+
1668+
Type parameters
1669+
^^^^^^^^^^^^^^^
1670+
1671+
:ref:`Type parameters <type-params>` can exist on classes, functions, and type
1672+
aliases.
1673+
1674+
.. class:: TypeVar(name, bound)
1675+
1676+
A :class:`typing.TypeVar`. ``name`` is the name of the type variable.
1677+
``bound`` is the bound or constraints, if any. If ``bound`` is a :class:`Tuple`,
1678+
it represents constraints; otherwise it represents the bound.
1679+
1680+
.. doctest::
1681+
1682+
>>> print(ast.dump(ast.parse("type Alias[T: int] = list[T]"), indent=4))
1683+
Module(
1684+
body=[
1685+
TypeAlias(
1686+
name=Name(id='Alias', ctx=Store()),
1687+
type_params=[
1688+
TypeVar(
1689+
name='T',
1690+
bound=Name(id='int', ctx=Load()))],
1691+
value=Subscript(
1692+
value=Name(id='list', ctx=Load()),
1693+
slice=Name(id='T', ctx=Load()),
1694+
ctx=Load()))],
1695+
type_ignores=[])
1696+
1697+
.. class:: ParamSpec(name)
1698+
1699+
A :class:`typing.ParamSpec`. ``name`` is the name of the parameter specification.
1700+
1701+
.. doctest::
1702+
1703+
>>> print(ast.dump(ast.parse("type Alias[**P] = Callable[P, int]"), indent=4))
1704+
Module(
1705+
body=[
1706+
TypeAlias(
1707+
name=Name(id='Alias', ctx=Store()),
1708+
type_params=[
1709+
ParamSpec(name='P')],
1710+
value=Subscript(
1711+
value=Name(id='Callable', ctx=Load()),
1712+
slice=Tuple(
1713+
elts=[
1714+
Name(id='P', ctx=Load()),
1715+
Name(id='int', ctx=Load())],
1716+
ctx=Load()),
1717+
ctx=Load()))],
1718+
type_ignores=[])
1719+
1720+
.. class:: TypeVarTuple(name)
1721+
1722+
A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable tuple.
1723+
1724+
.. doctest::
1725+
1726+
>>> print(ast.dump(ast.parse("type Alias[*Ts] = tuple[*Ts]"), indent=4))
1727+
Module(
1728+
body=[
1729+
TypeAlias(
1730+
name=Name(id='Alias', ctx=Store()),
1731+
type_params=[
1732+
TypeVarTuple(name='Ts')],
1733+
value=Subscript(
1734+
value=Name(id='tuple', ctx=Load()),
1735+
slice=Tuple(
1736+
elts=[
1737+
Starred(
1738+
value=Name(id='Ts', ctx=Load()),
1739+
ctx=Load())],
1740+
ctx=Load()),
1741+
ctx=Load()))],
1742+
type_ignores=[])
16471743

16481744
Function and class definitions
16491745
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16501746

1651-
.. class:: FunctionDef(name, args, body, decorator_list, returns, type_comment)
1747+
.. class:: FunctionDef(name, type_params, args, body, decorator_list, returns, type_comment)
16521748

16531749
A function definition.
16541750

16551751
* ``name`` is a raw string of the function name.
1752+
* ``type_params`` is a list of :ref:`type parameters <ast-type-params>`.
16561753
* ``args`` is an :class:`arguments` node.
16571754
* ``body`` is the list of nodes inside the function.
16581755
* ``decorator_list`` is the list of decorators to be applied, stored outermost
@@ -1820,18 +1917,16 @@ Function and class definitions
18201917
type_ignores=[])
18211918

18221919

1823-
.. class:: ClassDef(name, bases, keywords, starargs, kwargs, body, decorator_list)
1920+
.. class:: ClassDef(name, type_params, bases, keywords, body, decorator_list)
18241921

18251922
A class definition.
18261923

18271924
* ``name`` is a raw string for the class name
1925+
* ``type_params`` is a list of :ref:`type parameters <ast-type-params>`.
18281926
* ``bases`` is a list of nodes for explicitly specified base classes.
18291927
* ``keywords`` is a list of :class:`keyword` nodes, principally for 'metaclass'.
18301928
Other keywords will be passed to the metaclass, as per `PEP-3115
18311929
<https://peps.python.org/pep-3115/>`_.
1832-
* ``starargs`` and ``kwargs`` are each a single node, as in a function call.
1833-
starargs will be expanded to join the list of base classes, and kwargs will
1834-
be passed to the metaclass.
18351930
* ``body`` is a list of nodes representing the code within the class
18361931
definition.
18371932
* ``decorator_list`` is a list of nodes, as in :class:`FunctionDef`.

0 commit comments

Comments
 (0)