Skip to content

Commit 6f439d7

Browse files
authored
Merge branch 'main' into issue-102541
2 parents e5bdef0 + 178153c commit 6f439d7

File tree

1,185 files changed

+63194
-32563
lines changed

Some content is hidden

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

1,185 files changed

+63194
-32563
lines changed

.devcontainer/Dockerfile

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM docker.io/library/fedora:37
2+
3+
ENV CC=clang
4+
5+
ENV WASI_SDK_VERSION=19
6+
ENV WASI_SDK_PATH=/opt/wasi-sdk
7+
8+
ENV WASMTIME_HOME=/opt/wasmtime
9+
ENV WASMTIME_VERSION=7.0.0
10+
ENV WASMTIME_CPU_ARCH=x86_64
11+
12+
RUN dnf -y --nodocs --setopt=install_weak_deps=False install /usr/bin/{blurb,clang,curl,git,ln,tar,xz} 'dnf-command(builddep)' && \
13+
dnf -y --nodocs --setopt=install_weak_deps=False builddep python3 && \
14+
dnf -y clean all
15+
16+
RUN mkdir ${WASI_SDK_PATH} && \
17+
curl --location https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_VERSION}.0-linux.tar.gz | \
18+
tar --strip-components 1 --directory ${WASI_SDK_PATH} --extract --gunzip
19+
20+
RUN mkdir --parents ${WASMTIME_HOME} && \
21+
curl --location "https://github.com/bytecodealliance/wasmtime/releases/download/v${WASMTIME_VERSION}/wasmtime-v${WASMTIME_VERSION}-${WASMTIME_CPU_ARCH}-linux.tar.xz" | \
22+
xz --decompress | \
23+
tar --strip-components 1 --directory ${WASMTIME_HOME} -x && \
24+
ln -s ${WASMTIME_HOME}/wasmtime /usr/local/bin

.devcontainer/devcontainer.json

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"build": {
3+
"dockerfile": "Dockerfile"
4+
},
5+
"onCreateCommand": [
6+
// Install common tooling.
7+
"dnf",
8+
"install",
9+
"-y",
10+
"which",
11+
"zsh",
12+
"fish"
13+
],
14+
"updateContentCommand": {
15+
// Using the shell for `nproc` usage.
16+
"python": "./configure --config-cache --with-pydebug && make -s -j `nproc`",
17+
"docs": [
18+
"make",
19+
"--directory",
20+
"Doc",
21+
"venv",
22+
"html"
23+
]
24+
},
25+
"customizations": {
26+
"vscode": {
27+
"extensions": [
28+
// Highlighting for Parser/Python.asdl.
29+
"brettcannon.zephyr-asdl",
30+
// Highlighting for configure.ac.
31+
"maelvalais.autoconf",
32+
// C auto-complete.
33+
"ms-vscode.cpptools",
34+
// To view built docs.
35+
"ms-vscode.live-server"
36+
// https://github.com/microsoft/vscode-python/issues/18073
37+
// "ms-python.python"
38+
],
39+
"settings": {
40+
"C_Cpp.default.compilerPath": "/usr/bin/clang",
41+
"C_Cpp.default.cStandard": "c11",
42+
"C_Cpp.default.defines": [
43+
"CONFIG_64",
44+
"Py_BUILD_CORE"
45+
],
46+
"C_Cpp.default.includePath": [
47+
"${workspaceFolder}/*",
48+
"${workspaceFolder}/Include/**"
49+
],
50+
// https://github.com/microsoft/vscode-cpptools/issues/10732
51+
"C_Cpp.errorSquiggles": "disabled",
52+
"editor.insertSpaces": true,
53+
"editor.rulers": [
54+
80
55+
],
56+
"editor.tabSize": 4,
57+
"editor.trimAutoWhitespace": true,
58+
"files.associations": {
59+
"*.h": "c"
60+
},
61+
"files.encoding": "utf8",
62+
"files.eol": "\n",
63+
"files.insertFinalNewline": true,
64+
"files.trimTrailingWhitespace": true,
65+
"python.analysis.diagnosticSeverityOverrides": {
66+
// Complains about shadowing the stdlib w/ the stdlib.
67+
"reportShadowedImports": "none",
68+
// Doesn't like _frozen_importlib.
69+
"reportMissingImports": "none"
70+
},
71+
"python.analysis.extraPaths": [
72+
"Lib"
73+
],
74+
"python.defaultInterpreterPath": "./python",
75+
"[restructuredtext]": {
76+
"editor.tabSize": 3
77+
}
78+
}
79+
}
80+
}
81+
}

.gitattributes

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ Lib/test/test_importlib/resources/data01/* noeol
3232
Lib/test/test_importlib/resources/namespacedata01/* noeol
3333
Lib/test/xmltestdata/* noeol
3434

35+
# Shell scripts should have LF even on Windows because of Cygwin
36+
Lib/venv/scripts/common/activate text eol=lf
37+
Lib/venv/scripts/posix/* text eol=lf
38+
3539
# CRLF files
3640
[attr]dos text eol=crlf
3741

.github/CODEOWNERS

+8-7
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
# https://git-scm.com/docs/gitignore#_pattern_format
66

77
# GitHub
8-
.github/** @ezio-melotti
8+
.github/** @ezio-melotti @hugovk
9+
10+
# pre-commit
11+
.pre-commit-config.yaml @hugovk @AlexWaygood
912

1013
# Build system
1114
configure* @erlend-aasland @corona10
1215

1316
# asyncio
14-
**/*asyncio* @1st1 @asvetlov @gvanrossum @kumaraditya303
17+
**/*asyncio* @1st1 @asvetlov @gvanrossum @kumaraditya303 @willingc
1518

1619
# Core
1720
**/*context* @1st1
@@ -25,6 +28,8 @@ Objects/frameobject.c @markshannon
2528
Objects/call.c @markshannon
2629
Python/ceval.c @markshannon
2730
Python/compile.c @markshannon @iritkatriel
31+
Python/assemble.c @markshannon @iritkatriel
32+
Python/flowgraph.c @markshannon @iritkatriel
2833
Python/ast_opt.c @isidentical
2934
Lib/test/test_patma.py @brandtbucher
3035
Lib/test/test_peepholer.py @brandtbucher
@@ -61,11 +66,7 @@ Python/traceback.c @iritkatriel
6166
/Tools/build/parse_html5_entities.py @ezio-melotti
6267

6368
# Import (including importlib).
64-
# Ignoring importlib.h so as to not get flagged on
65-
# all pull requests that change the emitted
66-
# bytecode.
67-
**/*import*.c @brettcannon @encukou @ericsnowcurrently @ncoghlan @warsaw
68-
**/*import*.py @brettcannon @encukou @ericsnowcurrently @ncoghlan @warsaw
69+
**/*import* @brettcannon @encukou @ericsnowcurrently @ncoghlan @warsaw
6970
**/*importlib/resources/* @jaraco @warsaw @FFY00
7071
**/importlib/metadata/* @jaraco @warsaw
7172

.github/workflows/build.yml

+113-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ jobs:
3333
check_source:
3434
name: 'Check for source changes'
3535
runs-on: ubuntu-latest
36+
timeout-minutes: 10
3637
outputs:
3738
run_tests: ${{ steps.check.outputs.run_tests }}
39+
run_hypothesis: ${{ steps.check.outputs.run_hypothesis }}
3840
steps:
3941
- uses: actions/checkout@v3
4042
- name: Check for source changes
@@ -60,9 +62,21 @@ jobs:
6062
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
6163
fi
6264
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+
6376
check_generated_files:
6477
name: 'Check if generated files are up to date'
6578
runs-on: ubuntu-latest
79+
timeout-minutes: 60
6680
needs: check_source
6781
if: needs.check_source.outputs.run_tests == 'true'
6882
steps:
@@ -111,10 +125,14 @@ jobs:
111125
run: make smelly
112126
- name: Check limited ABI symbols
113127
run: make check-limited-abi
128+
- name: Check for unsupported C global variables
129+
if: github.event_name == 'pull_request' # $GITHUB_EVENT_NAME
130+
run: make check-c-globals
114131

115132
build_win32:
116133
name: 'Windows (x86)'
117134
runs-on: windows-latest
135+
timeout-minutes: 60
118136
needs: check_source
119137
if: needs.check_source.outputs.run_tests == 'true'
120138
env:
@@ -123,7 +141,6 @@ jobs:
123141
- uses: actions/checkout@v3
124142
- name: Build CPython
125143
run: .\PCbuild\build.bat -e -d -p Win32
126-
timeout-minutes: 30
127144
- name: Display build info
128145
run: .\python.bat -m test.pythoninfo
129146
- name: Tests
@@ -132,6 +149,7 @@ jobs:
132149
build_win_amd64:
133150
name: 'Windows (x64)'
134151
runs-on: windows-latest
152+
timeout-minutes: 60
135153
needs: check_source
136154
if: needs.check_source.outputs.run_tests == 'true'
137155
env:
@@ -142,7 +160,6 @@ jobs:
142160
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
143161
- name: Build CPython
144162
run: .\PCbuild\build.bat -e -d -p x64
145-
timeout-minutes: 30
146163
- name: Display build info
147164
run: .\python.bat -m test.pythoninfo
148165
- name: Tests
@@ -151,6 +168,7 @@ jobs:
151168
build_macos:
152169
name: 'macOS'
153170
runs-on: macos-latest
171+
timeout-minutes: 60
154172
needs: check_source
155173
if: needs.check_source.outputs.run_tests == 'true'
156174
env:
@@ -181,6 +199,7 @@ jobs:
181199
build_ubuntu:
182200
name: 'Ubuntu'
183201
runs-on: ubuntu-20.04
202+
timeout-minutes: 60
184203
needs: check_source
185204
if: needs.check_source.outputs.run_tests == 'true'
186205
env:
@@ -238,6 +257,7 @@ jobs:
238257
build_ubuntu_ssltests:
239258
name: 'Ubuntu SSL tests with OpenSSL'
240259
runs-on: ubuntu-20.04
260+
timeout-minutes: 60
241261
needs: check_source
242262
if: needs.check_source.outputs.run_tests == 'true'
243263
strategy:
@@ -283,10 +303,97 @@ jobs:
283303
- name: SSL tests
284304
run: ./python Lib/test/ssltests.py
285305

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+
286392
287393
build_asan:
288394
name: 'Address sanitizer'
289395
runs-on: ubuntu-20.04
396+
timeout-minutes: 60
290397
needs: check_source
291398
if: needs.check_source.outputs.run_tests == 'true'
292399
env:
@@ -299,6 +406,10 @@ jobs:
299406
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
300407
- name: Install Dependencies
301408
run: sudo ./.github/workflows/posix-deps-apt.sh
409+
- name: Set up GCC-10 for ASAN
410+
uses: egor-tensin/setup-gcc@v1
411+
with:
412+
version: 10
302413
- name: Configure OpenSSL env vars
303414
run: |
304415
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV

.github/workflows/build_msi.yml

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
build:
2727
name: Windows Installer
2828
runs-on: windows-latest
29+
timeout-minutes: 60
2930
strategy:
3031
matrix:
3132
type: [x86, x64, arm64]

0 commit comments

Comments
 (0)