Skip to content

Commit 483e6a4

Browse files
authored
Support for Python 3.13. (#319)
A continuation of the wonderful work by @kpfleming in #264 Adds initial support for Python 3.13 using CPython 3.13.0rc1. There are a few caveats and interesting details: - BOLT is disabled. There's a segmentation fault in the tests with the BOLT instrumented binaries. The BOLT optimizations are not critical, so we'll follow up on this separately. [See more context](zanieb#6 (comment)). - `mpdecimal` is now built from source on Windows. We already did this in Unix builds, but in Windows we were still using the bundled library. The bundled library is no longer used upstream and it seemed prudent to switch though it will remain available until 3.15. [See more context](zanieb#6 (comment)). - Apple cross-compilation is not available. I have a patch that adds support, but need to test it and it's not needed for these builds. [See more context](zanieb@447fb86). - `run_tests.py` was removed upstream. We provide a compatibility script that calls the appropriate command still so that our distributions are stable. We may want to change how `run_tests.py` is declared in the distribution metadata though. [See more context](#319 (comment)) .
1 parent b064e44 commit 483e6a4

20 files changed

+587
-32
lines changed

.github/workflows/apple.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,19 @@ jobs:
114114
py: 'cpython-3.12'
115115
optimizations: 'pgo+lto'
116116

117+
- target_triple: 'aarch64-apple-darwin'
118+
runner: macos-14
119+
py: 'cpython-3.13'
120+
optimizations: 'debug'
121+
- target_triple: 'aarch64-apple-darwin'
122+
runner: macos-14
123+
py: 'cpython-3.13'
124+
optimizations: 'pgo'
125+
- target_triple: 'aarch64-apple-darwin'
126+
runner: macos-14
127+
py: 'cpython-3.13'
128+
optimizations: 'pgo+lto'
129+
117130
# macOS on Intel hardware. This is pretty straightforward. We exclude
118131
# noopt because it doesn't provide any compelling advantages over PGO
119132
# or LTO builds.
@@ -181,6 +194,19 @@ jobs:
181194
runner: macos-13
182195
py: 'cpython-3.12'
183196
optimizations: 'pgo+lto'
197+
198+
- target_triple: 'x86_64-apple-darwin'
199+
runner: macos-13
200+
py: 'cpython-3.13'
201+
optimizations: 'debug'
202+
- target_triple: 'x86_64-apple-darwin'
203+
runner: macos-13
204+
py: 'cpython-3.13'
205+
optimizations: 'pgo'
206+
- target_triple: 'x86_64-apple-darwin'
207+
runner: macos-13
208+
py: 'cpython-3.13'
209+
optimizations: 'pgo+lto'
184210
needs:
185211
- pythonbuild
186212
runs-on: ${{ matrix.build.runner }}

.github/workflows/linux.yml

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,16 @@ jobs:
175175
py: 'cpython-3.12'
176176
optimizations: 'lto'
177177

178+
- target_triple: 'aarch64-unknown-linux-gnu'
179+
py: 'cpython-3.13'
180+
optimizations: 'debug'
181+
- target_triple: 'aarch64-unknown-linux-gnu'
182+
py: 'cpython-3.13'
183+
optimizations: 'noopt'
184+
- target_triple: 'aarch64-unknown-linux-gnu'
185+
py: 'cpython-3.13'
186+
optimizations: 'lto'
187+
178188
# Cross-compiles can't do PGO and require Python 3.9.
179189
- target_triple: 'armv7-unknown-linux-gnueabi'
180190
py: 'cpython-3.9'
@@ -216,6 +226,16 @@ jobs:
216226
py: 'cpython-3.12'
217227
optimizations: 'lto'
218228

229+
- target_triple: 'armv7-unknown-linux-gnueabi'
230+
py: 'cpython-3.13'
231+
optimizations: 'debug'
232+
- target_triple: 'armv7-unknown-linux-gnueabi'
233+
py: 'cpython-3.13'
234+
optimizations: 'noopt'
235+
- target_triple: 'armv7-unknown-linux-gnueabi'
236+
py: 'cpython-3.13'
237+
optimizations: 'lto'
238+
219239
# Cross-compiles can't do PGO and require Python 3.9.
220240
- target_triple: 'armv7-unknown-linux-gnueabihf'
221241
py: 'cpython-3.9'
@@ -257,6 +277,16 @@ jobs:
257277
py: 'cpython-3.12'
258278
optimizations: 'lto'
259279

280+
- target_triple: 'armv7-unknown-linux-gnueabihf'
281+
py: 'cpython-3.13'
282+
optimizations: 'debug'
283+
- target_triple: 'armv7-unknown-linux-gnueabihf'
284+
py: 'cpython-3.13'
285+
optimizations: 'noopt'
286+
- target_triple: 'armv7-unknown-linux-gnueabihf'
287+
py: 'cpython-3.13'
288+
optimizations: 'lto'
289+
260290
# Cross-compiles can't do PGO and require Python 3.9.
261291
- target_triple: 'mips-unknown-linux-gnu'
262292
py: 'cpython-3.9'
@@ -298,6 +328,16 @@ jobs:
298328
py: 'cpython-3.12'
299329
optimizations: 'lto'
300330

331+
- target_triple: 'mips-unknown-linux-gnu'
332+
py: 'cpython-3.13'
333+
optimizations: 'debug'
334+
- target_triple: 'mips-unknown-linux-gnu'
335+
py: 'cpython-3.13'
336+
optimizations: 'noopt'
337+
- target_triple: 'mips-unknown-linux-gnu'
338+
py: 'cpython-3.13'
339+
optimizations: 'lto'
340+
301341
# Cross-compiles can't do PGO and require Python 3.9.
302342
- target_triple: 'mipsel-unknown-linux-gnu'
303343
py: 'cpython-3.9'
@@ -339,6 +379,16 @@ jobs:
339379
py: 'cpython-3.12'
340380
optimizations: 'lto'
341381

382+
- target_triple: 'mipsel-unknown-linux-gnu'
383+
py: 'cpython-3.13'
384+
optimizations: 'debug'
385+
- target_triple: 'mipsel-unknown-linux-gnu'
386+
py: 'cpython-3.13'
387+
optimizations: 'noopt'
388+
- target_triple: 'mipsel-unknown-linux-gnu'
389+
py: 'cpython-3.13'
390+
optimizations: 'lto'
391+
342392
# Cross-compiles can't do PGO and require Python 3.9.
343393
- target_triple: 's390x-unknown-linux-gnu'
344394
py: 'cpython-3.9'
@@ -380,6 +430,16 @@ jobs:
380430
py: 'cpython-3.12'
381431
optimizations: 'lto'
382432

433+
- target_triple: 's390x-unknown-linux-gnu'
434+
py: 'cpython-3.13'
435+
optimizations: 'debug'
436+
- target_triple: 's390x-unknown-linux-gnu'
437+
py: 'cpython-3.13'
438+
optimizations: 'noopt'
439+
- target_triple: 's390x-unknown-linux-gnu'
440+
py: 'cpython-3.13'
441+
optimizations: 'lto'
442+
383443
# Cross-compiles can't do PGO and require Python 3.9.
384444
- target_triple: 'ppc64le-unknown-linux-gnu'
385445
py: 'cpython-3.9'
@@ -421,6 +481,16 @@ jobs:
421481
py: 'cpython-3.12'
422482
optimizations: 'lto'
423483

484+
- target_triple: 'ppc64le-unknown-linux-gnu'
485+
py: 'cpython-3.13'
486+
optimizations: 'debug'
487+
- target_triple: 'ppc64le-unknown-linux-gnu'
488+
py: 'cpython-3.13'
489+
optimizations: 'noopt'
490+
- target_triple: 'ppc64le-unknown-linux-gnu'
491+
py: 'cpython-3.13'
492+
optimizations: 'lto'
493+
424494
# We don't publish noopt builds when PGO is available.
425495
- target_triple: 'x86_64-unknown-linux-gnu'
426496
py: 'cpython-3.8'
@@ -487,6 +557,19 @@ jobs:
487557
optimizations: 'pgo+lto'
488558
run: true
489559

560+
- target_triple: 'x86_64-unknown-linux-gnu'
561+
py: 'cpython-3.13'
562+
optimizations: 'debug'
563+
run: true
564+
- target_triple: 'x86_64-unknown-linux-gnu'
565+
py: 'cpython-3.13'
566+
optimizations: 'pgo'
567+
run: true
568+
- target_triple: 'x86_64-unknown-linux-gnu'
569+
py: 'cpython-3.13'
570+
optimizations: 'pgo+lto'
571+
run: true
572+
490573
- target_triple: 'x86_64_v2-unknown-linux-gnu'
491574
py: 'cpython-3.9'
492575
optimizations: 'debug'
@@ -539,6 +622,19 @@ jobs:
539622
optimizations: 'pgo+lto'
540623
run: true
541624

625+
- target_triple: 'x86_64_v2-unknown-linux-gnu'
626+
py: 'cpython-3.13'
627+
optimizations: 'debug'
628+
run: true
629+
- target_triple: 'x86_64_v2-unknown-linux-gnu'
630+
py: 'cpython-3.13'
631+
optimizations: 'pgo'
632+
run: true
633+
- target_triple: 'x86_64_v2-unknown-linux-gnu'
634+
py: 'cpython-3.13'
635+
optimizations: 'pgo+lto'
636+
run: true
637+
542638
- target_triple: 'x86_64_v3-unknown-linux-gnu'
543639
py: 'cpython-3.9'
544640
optimizations: 'debug'
@@ -591,6 +687,19 @@ jobs:
591687
optimizations: 'pgo+lto'
592688
run: true
593689

690+
- target_triple: 'x86_64_v3-unknown-linux-gnu'
691+
py: 'cpython-3.13'
692+
optimizations: 'debug'
693+
run: true
694+
- target_triple: 'x86_64_v3-unknown-linux-gnu'
695+
py: 'cpython-3.13'
696+
optimizations: 'pgo'
697+
run: true
698+
- target_triple: 'x86_64_v3-unknown-linux-gnu'
699+
py: 'cpython-3.13'
700+
optimizations: 'pgo+lto'
701+
run: true
702+
594703
# GitHub Actions runners don't support x86-64-v4 so we can't PGO.
595704
- target_triple: 'x86_64_v4-unknown-linux-gnu'
596705
py: 'cpython-3.9'
@@ -633,6 +742,16 @@ jobs:
633742
py: 'cpython-3.12'
634743
optimizations: 'lto'
635744

745+
- target_triple: 'x86_64_v4-unknown-linux-gnu'
746+
py: 'cpython-3.13'
747+
optimizations: 'debug'
748+
- target_triple: 'x86_64_v4-unknown-linux-gnu'
749+
py: 'cpython-3.13'
750+
optimizations: 'noopt'
751+
- target_triple: 'x86_64_v4-unknown-linux-gnu'
752+
py: 'cpython-3.13'
753+
optimizations: 'lto'
754+
636755
# musl doesn't support PGO.
637756
- target_triple: 'x86_64-unknown-linux-musl'
638757
py: 'cpython-3.8'
@@ -699,6 +818,19 @@ jobs:
699818
optimizations: 'lto'
700819
run: true
701820

821+
- target_triple: 'x86_64-unknown-linux-musl'
822+
py: 'cpython-3.13'
823+
optimizations: 'debug'
824+
run: true
825+
- target_triple: 'x86_64-unknown-linux-musl'
826+
py: 'cpython-3.13'
827+
optimizations: 'noopt'
828+
run: true
829+
- target_triple: 'x86_64-unknown-linux-musl'
830+
py: 'cpython-3.13'
831+
optimizations: 'lto'
832+
run: true
833+
702834
- target_triple: 'x86_64_v2-unknown-linux-musl'
703835
py: 'cpython-3.9'
704836
optimizations: 'debug'
@@ -751,6 +883,19 @@ jobs:
751883
optimizations: 'lto'
752884
run: true
753885

886+
- target_triple: 'x86_64_v2-unknown-linux-musl'
887+
py: 'cpython-3.13'
888+
optimizations: 'debug'
889+
run: true
890+
- target_triple: 'x86_64_v2-unknown-linux-musl'
891+
py: 'cpython-3.13'
892+
optimizations: 'noopt'
893+
run: true
894+
- target_triple: 'x86_64_v2-unknown-linux-musl'
895+
py: 'cpython-3.13'
896+
optimizations: 'lto'
897+
run: true
898+
754899
- target_triple: 'x86_64_v3-unknown-linux-musl'
755900
py: 'cpython-3.9'
756901
optimizations: 'debug'
@@ -803,6 +948,19 @@ jobs:
803948
optimizations: 'lto'
804949
run: true
805950

951+
- target_triple: 'x86_64_v3-unknown-linux-musl'
952+
py: 'cpython-3.13'
953+
optimizations: 'debug'
954+
run: true
955+
- target_triple: 'x86_64_v3-unknown-linux-musl'
956+
py: 'cpython-3.13'
957+
optimizations: 'noopt'
958+
run: true
959+
- target_triple: 'x86_64_v3-unknown-linux-musl'
960+
py: 'cpython-3.13'
961+
optimizations: 'lto'
962+
run: true
963+
806964
- target_triple: 'x86_64_v4-unknown-linux-musl'
807965
py: 'cpython-3.9'
808966
optimizations: 'debug'
@@ -843,6 +1001,16 @@ jobs:
8431001
py: 'cpython-3.12'
8441002
optimizations: 'lto'
8451003

1004+
- target_triple: 'x86_64_v4-unknown-linux-musl'
1005+
py: 'cpython-3.13'
1006+
optimizations: 'debug'
1007+
- target_triple: 'x86_64_v4-unknown-linux-musl'
1008+
py: 'cpython-3.13'
1009+
optimizations: 'noopt'
1010+
- target_triple: 'x86_64_v4-unknown-linux-musl'
1011+
py: 'cpython-3.13'
1012+
optimizations: 'lto'
1013+
8461014
needs:
8471015
- pythonbuild
8481016
- image

.github/workflows/windows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jobs:
5454
- 'cpython-3.10'
5555
- 'cpython-3.11'
5656
- 'cpython-3.12'
57+
- 'cpython-3.13'
5758
vcvars:
5859
- 'vcvars32.bat'
5960
- 'vcvars64.bat'

cpython-unix/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@ $(OUTDIR)/cpython-3.11-$(CPYTHON_3.11_VERSION)-$(HOST_PLATFORM).tar: $(PYTHON_HO
270270
$(OUTDIR)/cpython-3.12-$(CPYTHON_3.12_VERSION)-$(HOST_PLATFORM).tar: $(PYTHON_HOST_DEPENDS)
271271
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) cpython-3.12-host
272272

273+
$(OUTDIR)/cpython-3.13-$(CPYTHON_3.13_VERSION)-$(HOST_PLATFORM).tar: $(PYTHON_HOST_DEPENDS)
274+
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) cpython-3.13-host
273275

274276
PYTHON_DEPENDS := \
275277
$(PYTHON_SUPPORT_FILES) \
@@ -318,3 +320,6 @@ $(OUTDIR)/cpython-$(CPYTHON_3.11_VERSION)-$(PACKAGE_SUFFIX).tar: $(ALL_PYTHON_DE
318320

319321
$(OUTDIR)/cpython-$(CPYTHON_3.12_VERSION)-$(PACKAGE_SUFFIX).tar: $(ALL_PYTHON_DEPENDS)
320322
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) cpython-3.12
323+
324+
$(OUTDIR)/cpython-$(CPYTHON_3.13_VERSION)-$(PACKAGE_SUFFIX).tar: $(ALL_PYTHON_DEPENDS)
325+
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) cpython-3.13

cpython-unix/build-cpython-host.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,18 @@ pushd "Python-${PYTHON_VERSION}"
3838
# configure. This is reported as https://bugs.python.org/issue45405. We nerf the
3939
# check since we know what we're doing.
4040
if [ "${CC}" = "clang" ]; then
41-
if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_9}" ]; then
41+
if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_13}" ]; then
42+
patch -p1 -i ${ROOT}/patch-disable-multiarch-13.patch
43+
elif [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_9}" ]; then
4244
patch -p1 -i ${ROOT}/patch-disable-multiarch.patch
4345
else
4446
patch -p1 -i ${ROOT}/patch-disable-multiarch-legacy.patch
4547
fi
48+
elif [ "${CC}" = "musl-clang" ]; then
49+
# Similarly, this is a problem for musl Clang on Python 3.13+
50+
if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_13}" ]; then
51+
patch -p1 -i ${ROOT}/patch-disable-multiarch-13.patch
52+
fi
4653
fi
4754

4855
autoconf

0 commit comments

Comments
 (0)