Skip to content

Commit 0f2b30f

Browse files
Merge remote-tracking branch 'origin/main' into pythongh-94906
2 parents 5e97978 + b58bc8c commit 0f2b30f

File tree

656 files changed

+29353
-13303
lines changed

Some content is hidden

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

656 files changed

+29353
-13303
lines changed

.github/CODEOWNERS

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
# GitHub
88
.github/** @ezio-melotti @hugovk
99

10+
# pre-commit
11+
.pre-commit-config.yaml @hugovk @AlexWaygood
12+
1013
# Build system
1114
configure* @erlend-aasland @corona10
1215

@@ -19,6 +22,7 @@ configure* @erlend-aasland @corona10
1922
**/*hamt* @1st1
2023
Objects/set* @rhettinger
2124
Objects/dict* @methane @markshannon
25+
Objects/typevarobject.c @JelleZijlstra
2226
Objects/type* @markshannon
2327
Objects/codeobject.c @markshannon
2428
Objects/frameobject.c @markshannon
@@ -30,6 +34,7 @@ Python/flowgraph.c @markshannon @iritkatriel
3034
Python/ast_opt.c @isidentical
3135
Lib/test/test_patma.py @brandtbucher
3236
Lib/test/test_peepholer.py @brandtbucher
37+
Lib/test/test_type_*.py @JelleZijlstra
3338

3439
# Exceptions
3540
Lib/traceback.py @iritkatriel

.github/dependabot.yml

+7
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,10 @@ updates:
1212
update-types:
1313
- "version-update:semver-minor"
1414
- "version-update:semver-patch"
15+
- package-ecosystem: "pip"
16+
directory: "/Tools/clinic/"
17+
schedule:
18+
interval: "monthly"
19+
labels:
20+
- "skip issue"
21+
- "skip news"

.github/workflows/build.yml

+98
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
timeout-minutes: 10
3737
outputs:
3838
run_tests: ${{ steps.check.outputs.run_tests }}
39+
run_hypothesis: ${{ steps.check.outputs.run_hypothesis }}
3940
steps:
4041
- uses: actions/checkout@v3
4142
- name: Check for source changes
@@ -61,6 +62,17 @@ jobs:
6162
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
6263
fi
6364
65+
# Check if we should run hypothesis tests
66+
GIT_BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
67+
echo $GIT_BRANCH
68+
if $(echo "$GIT_BRANCH" | grep -q -w '3\.\(8\|9\|10\|11\)'); then
69+
echo "Branch too old for hypothesis tests"
70+
echo "run_hypothesis=false" >> $GITHUB_OUTPUT
71+
else
72+
echo "Run hypothesis tests"
73+
echo "run_hypothesis=true" >> $GITHUB_OUTPUT
74+
fi
75+
6476
check_generated_files:
6577
name: 'Check if generated files are up to date'
6678
runs-on: ubuntu-latest
@@ -291,6 +303,92 @@ jobs:
291303
- name: SSL tests
292304
run: ./python Lib/test/ssltests.py
293305

306+
test_hypothesis:
307+
name: "Hypothesis Tests on Ubuntu"
308+
runs-on: ubuntu-20.04
309+
timeout-minutes: 60
310+
needs: check_source
311+
if: needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_hypothesis == 'true'
312+
env:
313+
OPENSSL_VER: 1.1.1t
314+
PYTHONSTRICTEXTENSIONBUILD: 1
315+
steps:
316+
- uses: actions/checkout@v3
317+
- name: Register gcc problem matcher
318+
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
319+
- name: Install Dependencies
320+
run: sudo ./.github/workflows/posix-deps-apt.sh
321+
- name: Configure OpenSSL env vars
322+
run: |
323+
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
324+
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
325+
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
326+
- name: 'Restore OpenSSL build'
327+
id: cache-openssl
328+
uses: actions/cache@v3
329+
with:
330+
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
331+
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
332+
- name: Install OpenSSL
333+
if: steps.cache-openssl.outputs.cache-hit != 'true'
334+
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
335+
- name: Add ccache to PATH
336+
run: |
337+
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
338+
- name: Configure ccache action
339+
uses: hendrikmuhs/ccache-action@v1.2
340+
- name: Setup directory envs for out-of-tree builds
341+
run: |
342+
echo "CPYTHON_RO_SRCDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-ro-srcdir)" >> $GITHUB_ENV
343+
echo "CPYTHON_BUILDDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-builddir)" >> $GITHUB_ENV
344+
- name: Create directories for read-only out-of-tree builds
345+
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
346+
- name: Bind mount sources read-only
347+
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
348+
- name: Configure CPython out-of-tree
349+
working-directory: ${{ env.CPYTHON_BUILDDIR }}
350+
run: ../cpython-ro-srcdir/configure --with-pydebug --with-openssl=$OPENSSL_DIR
351+
- name: Build CPython out-of-tree
352+
working-directory: ${{ env.CPYTHON_BUILDDIR }}
353+
run: make -j4
354+
- name: Display build info
355+
working-directory: ${{ env.CPYTHON_BUILDDIR }}
356+
run: make pythoninfo
357+
- name: Remount sources writable for tests
358+
# some tests write to srcdir, lack of pyc files slows down testing
359+
run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
360+
- name: Setup directory envs for out-of-tree builds
361+
run: |
362+
echo "CPYTHON_BUILDDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-builddir)" >> $GITHUB_ENV
363+
- name: "Create hypothesis venv"
364+
working-directory: ${{ env.CPYTHON_BUILDDIR }}
365+
run: |
366+
VENV_LOC=$(realpath -m .)/hypovenv
367+
VENV_PYTHON=$VENV_LOC/bin/python
368+
echo "HYPOVENV=${VENV_LOC}" >> $GITHUB_ENV
369+
echo "VENV_PYTHON=${VENV_PYTHON}" >> $GITHUB_ENV
370+
./python -m venv $VENV_LOC && $VENV_PYTHON -m pip install -U hypothesis
371+
- name: "Run tests"
372+
working-directory: ${{ env.CPYTHON_BUILDDIR }}
373+
run: |
374+
# Most of the excluded tests are slow test suites with no property tests
375+
#
376+
# (GH-104097) test_sysconfig is skipped because it has tests that are
377+
# failing when executed from inside a virtual environment.
378+
${{ env.VENV_PYTHON }} -m test \
379+
-W \
380+
-o \
381+
-j4 \
382+
-x test_asyncio \
383+
-x test_multiprocessing_fork \
384+
-x test_multiprocessing_forkserver \
385+
-x test_multiprocessing_spawn \
386+
-x test_concurrent_futures \
387+
-x test_socket \
388+
-x test_subprocess \
389+
-x test_signal \
390+
-x test_sysconfig
391+
294392
295393
build_asan:
296394
name: 'Address sanitizer'

.github/workflows/lint.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Lint
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
permissions:
6+
contents: read
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 10
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
- uses: actions/setup-python@v4
20+
with:
21+
python-version: "3.x"
22+
- uses: pre-commit/action@v3.0.0

.github/workflows/mypy.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Workflow to run mypy on select parts of the CPython repo
2+
name: mypy
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
paths:
10+
- "Tools/clinic/**"
11+
- ".github/workflows/mypy.yml"
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
17+
env:
18+
PIP_DISABLE_PIP_VERSION_CHECK: 1
19+
FORCE_COLOR: 1
20+
TERM: xterm-256color # needed for FORCE_COLOR to work on mypy on Ubuntu, see https://github.com/python/mypy/issues/13817
21+
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
24+
cancel-in-progress: true
25+
26+
jobs:
27+
mypy:
28+
name: Run mypy on Tools/clinic/
29+
runs-on: ubuntu-latest
30+
timeout-minutes: 10
31+
steps:
32+
- uses: actions/checkout@v3
33+
- uses: actions/setup-python@v4
34+
with:
35+
python-version: "3.x"
36+
cache: pip
37+
cache-dependency-path: Tools/clinic/requirements-dev.txt
38+
- run: pip install -r Tools/clinic/requirements-dev.txt
39+
- run: mypy --config-file Tools/clinic/mypy.ini

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

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
pull_request:
55
types: [opened, reopened, labeled, unlabeled, synchronize]
66

7+
permissions:
8+
issues: read
9+
pull-requests: read
10+
711
jobs:
812
label:
913
name: DO-NOT-MERGE / unresolved review

.pre-commit-config.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: check-yaml
6+
- id: trailing-whitespace
7+
types_or: [c, python, rst]

Doc/c-api/bytearray.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Byte Array Objects
66
------------------
77

8-
.. index:: object: bytearray
8+
.. index:: pair: object; bytearray
99

1010

1111
.. c:type:: PyByteArrayObject

Doc/c-api/bytes.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Bytes Objects
88
These functions raise :exc:`TypeError` when expecting a bytes parameter and
99
called with a non-bytes parameter.
1010

11-
.. index:: object: bytes
11+
.. index:: pair: object; bytes
1212

1313

1414
.. c:type:: PyBytesObject

Doc/c-api/capsule.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Capsules
66
--------
77

8-
.. index:: object: Capsule
8+
.. index:: pair: object; Capsule
99

1010
Refer to :ref:`using-capsules` for more information on using these objects.
1111

Doc/c-api/complex.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Complex Number Objects
66
----------------------
77

8-
.. index:: object: complex number
8+
.. index:: pair: object; complex number
99

1010
Python's complex number objects are implemented as two distinct types when
1111
viewed from the C API: one is the Python object exposed to Python programs, and

Doc/c-api/concrete.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ This section describes Python type objects and the singleton object ``None``.
4040
Numeric Objects
4141
===============
4242

43-
.. index:: object: numeric
43+
.. index:: pair: object; numeric
4444

4545
.. toctree::
4646

@@ -55,7 +55,7 @@ Numeric Objects
5555
Sequence Objects
5656
================
5757

58-
.. index:: object: sequence
58+
.. index:: pair: object; sequence
5959

6060
Generic operations on sequence objects were discussed in the previous chapter;
6161
this section deals with the specific kinds of sequence objects that are
@@ -77,7 +77,7 @@ intrinsic to the Python language.
7777
Container Objects
7878
=================
7979

80-
.. index:: object: mapping
80+
.. index:: pair: object; mapping
8181

8282
.. toctree::
8383

Doc/c-api/dict.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Dictionary Objects
66
------------------
77

8-
.. index:: object: dictionary
8+
.. index:: pair: object; dictionary
99

1010

1111
.. c:type:: PyDictObject
@@ -154,7 +154,7 @@ Dictionary Objects
154154
155155
.. c:function:: Py_ssize_t PyDict_Size(PyObject *p)
156156
157-
.. index:: builtin: len
157+
.. index:: pair: built-in function; len
158158
159159
Return the number of items in the dictionary. This is equivalent to
160160
``len(p)`` on a dictionary.

Doc/c-api/exceptions.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ Signal Handling
602602
.. c:function:: int PyErr_CheckSignals()
603603
604604
.. index::
605-
module: signal
605+
pair: module; signal
606606
single: SIGINT
607607
single: KeyboardInterrupt (built-in exception)
608608
@@ -633,7 +633,7 @@ Signal Handling
633633
.. c:function:: void PyErr_SetInterrupt()
634634
635635
.. index::
636-
module: signal
636+
pair: module; signal
637637
single: SIGINT
638638
single: KeyboardInterrupt (built-in exception)
639639
@@ -648,7 +648,7 @@ Signal Handling
648648
.. c:function:: int PyErr_SetInterruptEx(int signum)
649649
650650
.. index::
651-
module: signal
651+
pair: module; signal
652652
single: KeyboardInterrupt (built-in exception)
653653
654654
Simulate the effect of a signal arriving. The next time

Doc/c-api/file.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
File Objects
66
------------
77

8-
.. index:: object: file
8+
.. index:: pair: object; file
99

1010
These APIs are a minimal emulation of the Python 2 C API for built-in file
1111
objects, which used to rely on the buffered I/O (:c:expr:`FILE*`) support

Doc/c-api/float.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Floating Point Objects
66
----------------------
77

8-
.. index:: object: floating point
8+
.. index:: pair: object; floating point
99

1010

1111
.. c:type:: PyFloatObject

Doc/c-api/function.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Function Objects
66
----------------
77

8-
.. index:: object: function
8+
.. index:: pair: object; function
99

1010
There are a few functions specific to Python functions.
1111

0 commit comments

Comments
 (0)