Skip to content

Commit 8046eac

Browse files
authored
Merge branch 'main' into fix-test-msvcrt
2 parents d436f23 + 82505dc commit 8046eac

File tree

163 files changed

+3732
-2217
lines changed

Some content is hidden

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

163 files changed

+3732
-2217
lines changed

.azure-pipelines/ci.yml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
variables:
2-
coverage: false
3-
41
trigger: ['main', '3.11', '3.10', '3.9', '3.8', '3.7']
52

63
jobs:
@@ -51,33 +48,6 @@ jobs:
5148
dependencies: apt
5249

5350

54-
- job: Ubuntu_Coverage_CI_Tests
55-
displayName: Ubuntu CI Tests (coverage)
56-
dependsOn: Prebuild
57-
condition: |
58-
and(
59-
and(
60-
succeeded(),
61-
eq(variables['coverage'], 'true')
62-
),
63-
eq(dependencies.Prebuild.outputs['tests.run'], 'true')
64-
)
65-
66-
pool:
67-
vmImage: ubuntu-22.04
68-
69-
variables:
70-
testRunTitle: '$(Build.SourceBranchName)-linux-coverage'
71-
testRunPlatform: linux-coverage
72-
openssl_version: 1.1.1u
73-
74-
steps:
75-
- template: ./posix-steps.yml
76-
parameters:
77-
dependencies: apt
78-
coverage: true
79-
80-
8151
- job: Windows_CI_Tests
8252
displayName: Windows CI Tests
8353
dependsOn: Prebuild

.azure-pipelines/posix-steps.yml

Lines changed: 9 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
parameters:
2-
coverage: false
32
sudo_dependencies: sudo
43
dependencies: apt
54
patchcheck: true
@@ -23,47 +22,16 @@ steps:
2322
- script: make -j4
2423
displayName: 'Build CPython'
2524

26-
- ${{ if eq(parameters.coverage, 'true') }}:
27-
- script: ./python -m venv venv && ./venv/bin/python -m pip install -U coverage
28-
displayName: 'Set up virtual environment'
25+
- script: make pythoninfo
26+
displayName: 'Display build info'
2927

30-
- script: ./venv/bin/python -m test.pythoninfo
31-
displayName: 'Display build info'
32-
33-
- script: |
34-
$COMMAND -m coverage run --pylib -m test \
35-
--fail-env-changed \
36-
-uall,-cpu \
37-
--junit-xml=$(build.binariesDirectory)/test-results.xml \
38-
-x test_multiprocessing_fork \
39-
-x test_multiprocessing_forkserver \
40-
-x test_multiprocessing_spawn \
41-
-x test_concurrent_futures
42-
displayName: 'Tests with coverage'
43-
env:
44-
${{ if eq(parameters.xvfb, 'true') }}:
45-
COMMAND: xvfb-run ./venv/bin/python
46-
${{ if ne(parameters.xvfb, 'true') }}:
47-
COMMAND: ./venv/bin/python
48-
49-
- script: ./venv/bin/python -m coverage xml
50-
displayName: 'Generate coverage.xml'
51-
52-
- script: source ./venv/bin/activate && bash <(curl -s https://codecov.io/bash) -y .github/codecov.yml
53-
displayName: 'Publish code coverage results'
54-
55-
56-
- ${{ if ne(parameters.coverage, 'true') }}:
57-
- script: make pythoninfo
58-
displayName: 'Display build info'
59-
60-
- script: $COMMAND buildbottest TESTOPTS="-j4 -uall,-cpu --junit-xml=$(build.binariesDirectory)/test-results.xml"
61-
displayName: 'Tests'
62-
env:
63-
${{ if eq(parameters.xvfb, 'true') }}:
64-
COMMAND: xvfb-run make
65-
${{ if ne(parameters.xvfb, 'true') }}:
66-
COMMAND: make
28+
- script: $COMMAND buildbottest TESTOPTS="-j4 -uall,-cpu --junit-xml=$(build.binariesDirectory)/test-results.xml"
29+
displayName: 'Tests'
30+
env:
31+
${{ if eq(parameters.xvfb, 'true') }}:
32+
COMMAND: xvfb-run make
33+
${{ if ne(parameters.xvfb, 'true') }}:
34+
COMMAND: make
6735

6836
- ${{ if eq(parameters.patchcheck, 'true') }}:
6937
- script: |

.azure-pipelines/pr.yml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
variables:
2-
coverage: false
3-
41
pr: ['main', '3.11', '3.10', '3.9', '3.8', '3.7']
52

63
jobs:
@@ -53,33 +50,6 @@ jobs:
5350
dependencies: apt
5451

5552

56-
- job: Ubuntu_Coverage_PR_Tests
57-
displayName: Ubuntu PR Tests (coverage)
58-
dependsOn: Prebuild
59-
condition: |
60-
and(
61-
and(
62-
succeeded(),
63-
eq(variables['coverage'], 'true')
64-
),
65-
eq(dependencies.Prebuild.outputs['tests.run'], 'true')
66-
)
67-
68-
pool:
69-
vmImage: ubuntu-22.04
70-
71-
variables:
72-
testRunTitle: '$(Build.SourceBranchName)-linux-coverage'
73-
testRunPlatform: linux-coverage
74-
openssl_version: 1.1.1u
75-
76-
steps:
77-
- template: ./posix-steps.yml
78-
parameters:
79-
dependencies: apt
80-
coverage: true
81-
82-
8353
- job: Windows_PR_Tests
8454
displayName: Windows PR Tests
8555
dependsOn: Prebuild

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ PC/classicAppCompat.* binary
2424
[attr]noeol -text
2525

2626
Lib/test/cjkencodings/* noeol
27-
Lib/test/coding20731.py noeol
27+
Lib/test/tokenizedata/coding20731.py noeol
2828
Lib/test/decimaltestdata/*.decTest noeol
2929
Lib/test/test_email/data/*.txt noeol
3030
Lib/test/test_importlib/resources/data01/* noeol

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
# pre-commit
1111
.pre-commit-config.yaml @hugovk @AlexWaygood
12+
.ruff.toml @hugovk @AlexWaygood
1213

1314
# Build system
1415
configure* @erlend-aasland @corona10

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
# into the PR branch anyway.
6464
#
6565
# https://github.com/python/core-workflow/issues/373
66-
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
66+
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc|^\.pre-commit-config\.yaml$|\.ruff\.toml$)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
6767
fi
6868
6969
# Check if we should run hypothesis tests

.github/workflows/lint.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on: [push, pull_request, workflow_dispatch]
55
permissions:
66
contents: read
77

8+
env:
9+
FORCE_COLOR: 1
10+
RUFF_FORMAT: github
11+
812
concurrency:
913
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1014
cancel-in-progress: true

.github/workflows/require-pr-label.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ on:
55
types: [opened, reopened, labeled, unlabeled, synchronize]
66

77
permissions:
8-
issues: read
9-
pull-requests: read
8+
issues: write
9+
pull-requests: write
1010

1111
jobs:
1212
label:

.pre-commit-config.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.0.288
4+
hooks:
5+
- id: ruff
6+
name: Run Ruff on Lib/test/
7+
args: [--exit-non-zero-on-fix]
8+
files: ^Lib/test/
9+
210
- repo: https://github.com/pre-commit/pre-commit-hooks
311
rev: v4.4.0
412
hooks:
13+
- id: check-toml
14+
exclude: ^Lib/test/test_tomllib/
515
- id: check-yaml
616
- id: end-of-file-fixer
717
types: [python]
8-
exclude: Lib/test/coding20731.py
18+
exclude: Lib/test/tokenizedata/coding20731.py
919
- id: trailing-whitespace
1020
types_or: [c, python, rst]
1121

Doc/c-api/intro.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,30 @@ defined closer to where they are useful (e.g. :c:macro:`Py_RETURN_NONE`).
105105
Others of a more general utility are defined here. This is not necessarily a
106106
complete listing.
107107

108+
.. c:macro:: PyMODINIT_FUNC
109+
110+
Declare an extension module ``PyInit`` initialization function. The function
111+
return type is :c:expr:`PyObject*`. The macro declares any special linkage
112+
declarations required by the platform, and for C++ declares the function as
113+
``extern "C"``.
114+
115+
The initialization function must be named :samp:`PyInit_{name}`, where
116+
*name* is the name of the module, and should be the only non-\ ``static``
117+
item defined in the module file. Example::
118+
119+
static struct PyModuleDef spam_module = {
120+
PyModuleDef_HEAD_INIT,
121+
.m_name = "spam",
122+
...
123+
};
124+
125+
PyMODINIT_FUNC
126+
PyInit_spam(void)
127+
{
128+
return PyModule_Create(&spam_module);
129+
}
130+
131+
108132
.. c:macro:: Py_ABS(x)
109133
110134
Return the absolute value of ``x``.

Doc/library/dis.rst

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ not have to be) the original ``STACK[-2]``.
597597

598598
key = STACK.pop()
599599
container = STACK.pop()
600-
STACK.append(container[index])
600+
STACK.append(container[key])
601601

602602

603603
.. opcode:: STORE_SUBSCR
@@ -1122,7 +1122,8 @@ iterations of the loop.
11221122
This bytecode distinguishes two cases: if ``STACK[-1]`` has a method with the
11231123
correct name, the bytecode pushes the unbound method and ``STACK[-1]``.
11241124
``STACK[-1]`` will be used as the first argument (``self``) by :opcode:`CALL`
1125-
when calling the unbound method. Otherwise, ``NULL`` and the object returned by
1125+
or :opcode:`CALL_KW` when calling the unbound method.
1126+
Otherwise, ``NULL`` and the object returned by
11261127
the attribute lookup are pushed.
11271128

11281129
.. versionchanged:: 3.12
@@ -1390,32 +1391,48 @@ iterations of the loop.
13901391

13911392
.. opcode:: CALL (argc)
13921393

1393-
Calls a callable object with the number of arguments specified by ``argc``,
1394-
including the named arguments specified by the preceding
1395-
:opcode:`KW_NAMES`, if any.
1396-
On the stack are (in ascending order), either:
1394+
Calls a callable object with the number of arguments specified by ``argc``.
1395+
On the stack are (in ascending order):
13971396

1398-
* NULL
13991397
* The callable
1400-
* The positional arguments
1401-
* The named arguments
1402-
1403-
or:
1404-
1405-
* The callable
1406-
* ``self``
1398+
* ``self`` or ``NULL``
14071399
* The remaining positional arguments
1408-
* The named arguments
14091400

1410-
``argc`` is the total of the positional and named arguments, excluding
1411-
``self`` when a ``NULL`` is not present.
1401+
``argc`` is the total of the positional arguments, excluding ``self``.
14121402

14131403
``CALL`` pops all arguments and the callable object off the stack,
14141404
calls the callable object with those arguments, and pushes the return value
14151405
returned by the callable object.
14161406

14171407
.. versionadded:: 3.11
14181408

1409+
.. versionchanged:: 3.13
1410+
The callable now always appears at the same position on the stack.
1411+
1412+
.. versionchanged:: 3.13
1413+
Calls with keyword arguments are now handled by :opcode:`CALL_KW`.
1414+
1415+
1416+
.. opcode:: CALL_KW (argc)
1417+
1418+
Calls a callable object with the number of arguments specified by ``argc``,
1419+
including one or more named arguments. On the stack are (in ascending order):
1420+
1421+
* The callable
1422+
* ``self`` or ``NULL``
1423+
* The remaining positional arguments
1424+
* The named arguments
1425+
* A :class:`tuple` of keyword argument names
1426+
1427+
``argc`` is the total of the positional and named arguments, excluding ``self``.
1428+
The length of the tuple of keyword argument names is the number of named arguments.
1429+
1430+
``CALL_KW`` pops all arguments, the keyword names, and the callable object
1431+
off the stack, calls the callable object with those arguments, and pushes the
1432+
return value returned by the callable object.
1433+
1434+
.. versionadded:: 3.13
1435+
14191436

14201437
.. opcode:: CALL_FUNCTION_EX (flags)
14211438

@@ -1441,15 +1458,6 @@ iterations of the loop.
14411458
.. versionadded:: 3.11
14421459

14431460

1444-
.. opcode:: KW_NAMES (consti)
1445-
1446-
Prefixes :opcode:`CALL`.
1447-
Stores a reference to ``co_consts[consti]`` into an internal variable
1448-
for use by :opcode:`CALL`. ``co_consts[consti]`` must be a tuple of strings.
1449-
1450-
.. versionadded:: 3.11
1451-
1452-
14531461
.. opcode:: MAKE_FUNCTION
14541462

14551463
Pushes a new function object on the stack built from the code object at ``STACK[1]``.
@@ -1611,8 +1619,8 @@ iterations of the loop.
16111619
opcodes in the range [0,255] which don't use their argument and those
16121620
that do (``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively).
16131621

1614-
If your application uses pseudo instructions, use the :data:`hasarg`
1615-
collection instead.
1622+
If your application uses pseudo instructions or specialized instructions,
1623+
use the :data:`hasarg` collection instead.
16161624

16171625
.. versionchanged:: 3.6
16181626
Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT``
@@ -1623,6 +1631,8 @@ iterations of the loop.
16231631
it is not true that comparison with ``HAVE_ARGUMENT`` indicates whether
16241632
they use their arg.
16251633

1634+
.. deprecated:: 3.13
1635+
Use :data:`hasarg` instead.
16261636

16271637
.. opcode:: CALL_INTRINSIC_1
16281638

Doc/library/importlib.resources.abc.rst

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343
:const:`None`. An object compatible with this ABC should only be
4444
returned when the specified module is a package.
4545

46-
.. versionadded:: 3.7
47-
4846
.. deprecated-removed:: 3.12 3.14
4947
Use :class:`importlib.resources.abc.TraversableResources` instead.
5048

@@ -95,11 +93,6 @@
9593
For a representation of the object on the file-system, use
9694
:meth:`importlib.resources.as_file`.
9795

98-
.. versionadded:: 3.9
99-
100-
.. deprecated-removed:: 3.12 3.14
101-
Use :class:`importlib.resources.abc.Traversable` instead.
102-
10396
.. attribute:: name
10497

10598
Abstract. The base name of this object without any parent references.
@@ -153,11 +146,6 @@
153146
Loaders that wish to support resource reading are expected to
154147
implement this interface.
155148

156-
.. versionadded:: 3.9
157-
158-
.. deprecated-removed:: 3.12 3.14
159-
Use :class:`importlib.resources.abc.TraversableResources` instead.
160-
161149
.. abstractmethod:: files()
162150

163151
Returns a :class:`importlib.resources.abc.Traversable` object for the loaded

0 commit comments

Comments
 (0)