8000 Merge branch 'main' into main · python/cpython@a1186c9 · GitHub
[go: up one dir, main page]

Skip to content

Commit a1186c9

Browse files
authored
Merge branch 'main' into main
2 parents 38d5abc + 102685c commit a1186c9

File tree

171 files changed

+19986
-1793
lines changed

Some content is hidden

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

171 files changed

+19986
-1793
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Doc/c-api/stable.rst @encukou
151151

152152
**/*idlelib* @terryjreedy
153153

154-
**/*typing* @gvanrossum @Fidget-Spinner @JelleZijlstra @AlexWaygood
154+
**/*typing* @gvanrossum @JelleZijlstra @AlexWaygood
155155

156156
**/*ftplib @giampaolo
157157
**/*shutil @giampaolo

.github/workflows/build.yml

Lines changed: 40 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -178,140 +178,63 @@ jobs:
178178
if: github.event_name == 'pull_request' # $GITHUB_EVENT_NAME
179179
run: make check-c-globals
180180

181-
build_win32:
182-
name: 'Windows (x86)'
183-
runs-on: windows-latest
184-
timeout-minutes: 60
185-
needs: check_source
186-
if: needs.check_source.outputs.run_tests == 'true'
187-
env:
188-
IncludeUwp: 'true'
189-
steps:
190-
- uses: actions/checkout@v4
191-
- name: Build CPython
192-
run: .\PCbuild\build.bat -e -d -p Win32
193-
- name: Display build info
194-
run: .\python.bat -m test.pythoninfo
195-
- name: Tests
196-
run: .\PCbuild\rt.bat -p Win32 -d -q --fast-ci
197-
198-
build_win_amd64:
199-
name: 'Windows (x64)'
200-
runs-on: windows-latest
201-
timeout-minutes: 60
181+
build_windows:
182+
name: 'Windows'
202183
needs: check_source
203184
if: needs.check_source.outputs.run_tests == 'true'
204-
env:
205-
IncludeUwp: 'tru 10000 e'
206-
steps:
207-
- uses: actions/checkout@v4
208-
- name: Register MSVC problem matcher
209-
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
210-
- name: Build CPython
211-
run: .\PCbuild\build.bat -e -d -p x64
212-
- name: Display build info
213-
run: .\python.bat -m test.pythoninfo
214-
- name: Tests
215-
run: .\PCbuild\rt.bat -p x64 -d -q --fast-ci
185+
uses: ./.github/workflows/reusable-windows.yml
216186

217-
build_win_arm64:
218-
name: 'Windows (arm64)'
219-
runs-on: windows-latest
220-
timeout-minutes: 60
187+
build_windows_free_threaded:
188+
name: 'Windows (free-threaded)'
221189
needs: check_source
222-
if: needs.check_source.outputs.run_tests == 'true'
223-
env:
224-
IncludeUwp: 'true'
225-
steps:
226-
- uses: actions/checkout@v4
227-
- name: Register MSVC problem matcher
228-
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
229-
- name: Build CPython
230-
run: .\PCbuild\build.bat -e -d -p arm64
190+
if: needs.check_source.outputs.run_tests == 'true' && contains(github.event.pull_request.labels.*.name, 'topic-free-threaded')
191+
uses: ./.github/workflows/reusable-windows.yml
192+
with:
193+
free-threaded: true
231194

232195
build_macos:
233196
name: 'macOS'
234197
needs: check_source
235198
if: needs.check_source.outputs.run_tests == 'true'
236-
uses: ./.github/workflows/reusable-build-macos.yml
199+
uses: ./.github/workflows/reusable-macos.yml
237200
with:
238201
config_hash: ${{ needs.check_source.outputs.config_hash }}
239202

240203
build_macos_free_threaded:
241204
name: 'macOS (free-threaded)'
242205
needs: check_source
243206
if: needs.check_source.outputs.run_tests == 'true' && contains(github.event.pull_request.labels.*.name, 'topic-free-threaded')
244-
uses: ./.github/workflows/reusable-build-macos.yml
207+
uses: ./.github/workflows/reusable-macos.yml
245208
with:
246209
config_hash: ${{ needs.check_source.outputs.config_hash }}
247210
free-threaded: true
248211

249212
build_ubuntu:
250213
name: 'Ubuntu'
251-
runs-on: ubuntu-20.04
252-
timeout-minutes: 60
253214
needs: check_source
254215
if: needs.check_source.outputs.run_tests == 'true'
255-
env:
256-
OPENSSL_VER: 3.0.11
257-
PYTHONSTRICTEXTENSIONBUILD: 1
258-
steps:
259-
- uses: actions/checkout@v4
260-
- name: Register gcc problem matcher
261-
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
262-
- name: Install dependencies
263-
run: sudo ./.github/workflows/posix-deps-apt.sh
264-
- name: Configure OpenSSL env vars
265-
run: |
266-
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
267-
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
268-
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
269-
- name: 'Restore OpenSSL build'
270-
id: cache-openssl
271-
uses: actions/cache@v3
272-
with:
273-
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
274-
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
275-
- nam 4E34 e: Install OpenSSL
276-
if: steps.cache-openssl.outputs.cache-hit != 'true'
277-
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
278-
- name: Add ccache to PATH
279-
run: |
280-
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
281-
- name: Configure ccache action
282-
uses: hendrikmuhs/ccache-action@v1.2
283-
- name: Setup directory envs for out-of-tree builds
284-
run: |
285-
echo "CPYTHON_RO_SRCDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-ro-srcdir)" >> $GITHUB_ENV
286-
echo "CPYTHON_BUILDDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-builddir)" >> $GITHUB_ENV
287-
- name: Create directories for read-only out-of-tree builds
288-
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
289-
- name: Bind mount sources read-only
290-
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
291-
- name: Restore config.cache
292-
uses: actions/cache@v3
293-
with:
294-
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
295-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
296-
- name: Configure CPython out-of-tree
297-
working-directory: ${{ env.CPYTHON_BUILDDIR }}
298-
run: |
216+
uses: ./.github/workflows/reusable-ubuntu.yml
217+
with:
218+
config_hash: ${{ needs.check_source.outputs.config_hash }}
219+
options: |
299220
../cpython-ro-srcdir/configure \
300221
--config-cache \
301222
--with-pydebug \
302223
--with-openssl=$OPENSSL_DIR
303-
- name: Build CPython out-of-tree
304-
working-directory: ${{ env.CPYTHON_BUILDDIR }}
305-
run: make -j4
306-
- name: Display build info
307-
working-directory: ${{ env.CPYTHON_BUILDDIR }}
308-
run: make pythoninfo
309-
- name: Remount sources writable for tests
310-
# some tests write to srcdir, lack of pyc files slows down testing
311-
run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
312-
- name: Tests
313-
working-directory: ${{ env.CPYTHON_BUILDDIR }}
314-
run: xvfb-run make test
224+
225+
build_ubuntu_free_threaded:
226+
name: 'Ubuntu (free-threaded)'
227+
needs: check_source
228+
if: needs.check_source.outputs.run_tests == 'true' && contains(github.event.pull_request.labels.*.name, 'topic-free-threaded')
229+
uses: ./.github/workflows/reusable-ubuntu.yml
230+
with:
231+
config_hash: ${{ needs.check_source.outputs.config_hash }}
232+
options: |
233+
../cpython-ro-srcdir/configure \
234+
--config-cache \
235+
--with-pydebug \
236+
--with-openssl=$OPENSSL_DIR \
237+
--disable-gil
315238
316239
build_ubuntu_ssltests:
317240
name: 'Ubuntu SSL tests with OpenSSL'
@@ -577,12 +500,13 @@ jobs:
577500
- check_source # Transitive dependency, needed to access `run_tests` value
578501
- check-docs
579502
- check_generated_files
580-
- build_win32
581-
- build_win_amd64
582-
- build_win_arm64
583503
- build_macos
504+
- build_macos_free_threaded
584505
- build_ubuntu
506+
- build_ubuntu_free_threaded
585507
- build_ubuntu_ssltests
508+
- build_windows
509+
- build_windows_free_threaded
586510
- test_hypothesis
587511
- build_asan
588512
- cifuzz
@@ -595,9 +519,10 @@ jobs:
595519
with:
596520
allowed-failures: >-
597521
build_macos,
522+
build_macos_free_threaded,
523+
build_ubuntu_free_threaded,
598524
build_ubuntu_ssltests,
599-
build_win32,
600-
build_win_arm64,
525+
build_windows_free_threaded,
601526
cifuzz,
602527
test_hypothesis,
603528
allowed-skips: >-
@@ -612,12 +537,13 @@ jobs:
612537
needs.check_source.outputs.run_tests != 'true'
613538
&& '
614539
check_generated_files,
615-
build_win32,
616-
build_win_amd64,
617-
build_win_arm64,
618540
build_macos,
541+
build_macos_free_threaded,
619542
build_ubuntu,
543+
build_ubuntu_free_threaded,
620544
build_ubuntu_ssltests,
545+
build_windows,
546+
build_windows_free_threaded,
621547
build_asan,
622548
'
623549
|| ''

.github/workflows/reusable-build-macos.yml renamed to .github/workflows/reusable-macos.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111

1212
jobs:
1313
build_macos:
14+
name: 'build and test'
1415
runs-on: macos-latest
1516
timeout-minutes: 60
1617
env:

.github/workflows/reusable-ubuntu.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
config_hash:
5+
required: true
6+
type: string
7+
options:
8+
required: true
9+
type: string
10+
11+
jobs:
12+
build_ubuntu_reusable:
13+
name: 'build and test'
14+
timeout-minutes: 60
15+
runs-on: ubuntu-20.04
16+
env:
17+
OPENSSL_VER: 3.0.11
18+
PYTHONSTRICTEXTENSIONBUILD: 1
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Register gcc problem matcher
22+
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
23+
- name: Install dependencies
24+
run: sudo ./.github/workflows/posix-deps-apt.sh
25+
- name: Configure OpenSSL env vars
26+
run: |
27+
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
28+
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
29+
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
30+
- name: 'Restore OpenSSL build'
31+
id: cache-openssl
32+
uses: actions/cache@v3
33+
with:
34+
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
35+
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
36+
- name: Install OpenSSL
37+
if: steps.cache-openssl.outputs.cache-hit != 'true'
38+
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
39+
- name: Add ccache to PATH
40+
run: |
41+
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
42+
- name: Configure ccache action
43+
uses: hendrikmuhs/ccache-action@v1.2
44+
- name: Setup directory envs for out-of-tree builds
45+
run: |
46+
echo "CPYTHON_RO_SRCDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-ro-srcdir)" >> $GITHUB_ENV
47+
echo "CPYTHON_BUILDDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-builddir)" >> $GITHUB_ENV
48+
- name: Create directories for read-only out-of-tree builds
49+
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
50+
- name: Bind mount sources read-only
51+
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
52+
- name: Restore config.cache
53+
uses: actions/cache@v3
54+
with:
55+
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
56+
key: ${{ github.job }}-${{ runner.os }}-${{ inputs.config_hash }}
57+
- name: Configure CPython out-of-tree
58+
working-directory: ${{ env.CPYTHON_BUILDDIR }}
59+
run: ${{ inputs.options }}
60+
- name: Build CPython out-of-tree
61+
working-directory: ${{ env.CPYTHON_BUILDDIR }}
62+
run: make -j4
63+
- name: Display build info
64+
working-directory: ${{ env.CPYTHON_BUILDDIR }}
65+
run: make pythoninfo
66+
- name: Remount sources writable for tests
67+
# some tests write to srcdir, lack of pyc files slows down testing
68+
run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
69+
- name: Tests
70+
working-directory: ${{ env.CPYTHON_BUILDDIR }}
71+
run: xvfb-run make test
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
free-threaded:
5+
required: false
6+
type: boolean
7+
default: false
8+
9+
jobs:
10+
build_win32:
11+
name: 'build and test (x86)'
12+
runs-on: windows-latest
13+
timeout-minutes: 60
14+
env:
15+
IncludeUwp: 'true'
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Build CPython
19+
run: .\PCbuild\build.bat -e -d -p Win32 ${{ inputs.free-threaded && '--disable-gil' || '' }}
20+
- name: Display build info
21+
run: .\python.bat -m test.pythoninfo
22+
- name: Tests
23+
run: .\PCbuild\rt.bat -p Win32 -d -q --fast-ci
24+
25+
build_win_amd64:
26+
name: 'build and test (x64)'
27+
runs-on: windows-latest
28+
timeout-minutes: 60
29+
env:
30+
IncludeUwp: 'true'
31+
steps:
32+
- uses: actions/checkout@v4
33+
- name: Register MSVC problem matcher
34+
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
35+
- name: Build CPython
36+
run: .\PCbuild\build.bat -e -d -p x64 ${{ inputs.free-threaded && '--disable-gil' || '' }}
37+
- name: Display build info
38+
run: .\python.bat -m test.pythoninfo
39+
- name: Tests
40+
run: .\PCbuild\rt.bat -p x64 -d -q --fast-ci
41+
42+
build_win_arm64:
43+
name: 'build (arm64)'
44+
runs-on: windows-latest
45+
timeout-minutes: 60
46+
env:
47+
IncludeUwp: 'true'
48+
steps:
49+
- uses: actions/checkout@v4
50+
- name: Register MSVC problem matcher
51+
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
52+
- name: Build CPython
53+
run: .\PCbuild\build.bat -e -d -p arm64 ${{ inputs.free-threaded && '--disable-gil' || '' }}

Doc/c-api/exceptions.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,37 @@ Printing and clearing
8888
The function is called with a single argument *obj* that identifies the context
8989
in which the unraisable exception occurred. If possible,
9090
the repr of *obj* will be printed in the warning message.
91+
If *obj* is ``NULL``, only the traceback is printed.
9192
9293
An exception must be set when calling this function.
9394
95+
.. versionchanged:: 3.4
96+
Print a traceback. Print only traceback if *obj* is ``NULL``.
97+
98+
.. versionchanged:: 3.8
99+
Use :func:`sys.unraisablehook`.
100+
101+
102+
.. c:function:: void PyErr_FormatUnraisable(const char *format, ...)
103+
104+
Similar to :c:func:`PyErr_WriteUnraisable`, but the *format* and subsequent
105+
parameters help format the warning message; they have the same meaning and
106+
values as in :c:func:`PyUnicode_FromFormat`.
107+
``PyErr_WriteUnraisable(obj)`` is roughtly equivalent to
108+
``PyErr_FormatUnraisable("Exception ignored in: %R, obj)``.
109+
If *format* is ``NULL``, only the traceback is printed.
110+
111+
.. versionadded:: 3.13
112+
113+
94114
.. c:function:: void PyErr_DisplayException(PyObject *exc)
95115
96116
Print the standard traceback display of ``exc`` to ``sys.stderr``, including
97117
chained exceptions and notes.
98118
99119
.. versionadded:: 3.12
100120
121+
101122
Raising exceptions
102123
==================
103124

0 commit comments

Comments
 (0)
0