Skip to content

Commit d2030cb

Browse files
zaniebWingysamgeofft
authored
Update to 3.14.0b1 (#610)
- python/cpython#133027 - python/cpython#133366 - python/cpython#133284 - python/cpython#133398 - python/cpython#131298 - python/cpython#132438 - python/cpython#133012 --------- Co-authored-by: Wingy <git@wingysam.xyz> Co-authored-by: Geoffrey Thomas <geofft@ldpreload.com>
1 parent 8f3c1d1 commit d2030cb

File tree

8 files changed

+144
-40
lines changed

8 files changed

+144
-40
lines changed

cpython-unix/build-cpython.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,8 @@ if [ -n "${CPYTHON_OPTIMIZED}" ]; then
466466

467467
# Do not enable on x86-64 macOS because the JIT requires macOS 11+ and we are currently
468468
# using 10.15 as a miniumum version.
469-
if [ "${TARGET_TRIPLE}" != "x86_64-apple-darwin" ]; then
469+
# Do not enable when free-threading, because they're not compatible yet.
470+
if [[ ! ( "${TARGET_TRIPLE}" == "x86_64-apple-darwin" || -n "${CPYTHON_FREETHREADED}" ) ]]; then
470471
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --enable-experimental-jit=yes-off"
471472
fi
472473

@@ -588,6 +589,13 @@ if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_14}" && -n "${CROSS_COMPILING}" && "$
588589
export PROFILE_TASK='-m test --pgo --ignore test_strftime_y2k'
589590
fi
590591

592+
# ./configure tries to auto-detect whether it can build 128-bit and 256-bit SIMD helpers for HACL,
593+
# but on x86-64 that requires v2 and v3 respectively, and on arm64 the performance is bad as noted
594+
# in the comments, so just don't even try. (We should check if we can make this conditional)
595+
if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_14}" ]]; then
596+
patch -p1 -i "${ROOT}/patch-python-configure-hacl-no-simd.patch"
597+
fi
598+
591599
# We use ndbm on macOS and BerkeleyDB elsewhere.
592600
if [[ "${PYBUILD_PLATFORM}" = macos* ]]; then
593601
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --with-dbmliborder=ndbm"

cpython-unix/extension-modules.yml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ _blake2:
4343
minimum-python-version: "3.14"
4444
- define: _DEFAULT_SOURCE
4545
minimum-python-version: "3.14"
46-
# Disable `explicit_bzero`, it requires glib 2.25+
46+
# Disable `explicit_bzero`, it requires glibc 2.25+
4747
- define: LINUX_NO_EXPLICIT_BZERO
4848
minimum-python-version: "3.14"
4949

@@ -88,6 +88,9 @@ _collections:
8888
_contextvars:
8989
sources:
9090
- _contextvarsmodule.c
91+
config-c-only-conditional:
92+
- config-c-only: true
93+
minimum-python-version: "3.14"
9194

9295
_crypt:
9396
maximum-python-version: "3.12"
@@ -315,12 +318,6 @@ _hmac:
315318
includes:
316319
- Modules/_hacl/
317320
- Modules/_hacl/include/
318-
links:
319-
- :libHacl_Hash_Blake2.a
320-
- :libHacl_Hash_SHA1.a
321-
- :libHacl_Hash_SHA2.a
322-
- :libHacl_Hash_SHA3.a
323-
- :libHacl_Hash_MD5.a
324321
defines:
325322
- _BSD_SOURCE
326323
- _DEFAULT_SOURCE
@@ -376,7 +373,6 @@ _md5:
376373
sources-conditional:
377374
- source: _hacl/Hacl_Hash_MD5.c
378375
minimum-python-version: "3.12"
379-
maximum-python-version: "3.13"
380376
defines-conditional:
381377
- define: _BSD_SOURCE
382378
minimum-python-version: "3.12"
@@ -435,6 +431,12 @@ _random:
435431
sources:
436432
- _randommodule.c
437433

434+
435+
_remote_debugging:
436+
minimum-python-version: "3.14"
437+
sources:
438+
- _remote_debugging_module.c
439+
438440
_scproxy:
439441
# _scproxy is Apple OS only.
440442
# APIs required by _scproxy not available on iOS.
@@ -453,7 +455,6 @@ _sha1:
453455
sources-conditional:
454456
- source: _hacl/Hacl_Hash_SHA1.c
455457
minimum-python-version: "3.12"
456-
maximum-python-version: "3.13"
457458
includes:
458459
- Modules/_hacl/include
459460
defines-conditional:
@@ -475,7 +476,6 @@ _sha2:
475476
- sha2module.c
476477
sources-conditional:
477478
- source: _hacl/Hacl_Hash_SHA2.c
478-
maximum-python-version: "3.13"
479479
includes:
480480
- Modules/_hacl/include
481481
defines:
@@ -491,7 +491,6 @@ _sha3:
491491
minimum-python-version: "3.12"
492492
- source: _hacl/Hacl_Hash_SHA3.c
493493
minimum-python-version: "3.12"
494-
maximum-python-version: "3.13"
495494
includes:
496495
- Modules/_hacl/include
497496
defines-conditional:
@@ -617,6 +616,7 @@ _testcapi:
617616

618617
_testexternalinspection:
619618
minimum-python-version: '3.13'
619+
maximum-python-version: '3.13'
620620
sources:
621621
- _testexternalinspection.c
622622

@@ -645,6 +645,8 @@ _testinternalcapi:
645645
minimum-python-version: "3.13"
646646
- source: _testinternalcapi/test_lock.c
647647
minimum-python-version: "3.13"
648+
- source: _testinternalcapi/complex.c
649+
minimum-python-version: "3.14"
648650

649651
_testmultiphase:
650652
minimum-python-version: '3.9'
@@ -769,6 +771,17 @@ _xxtestfuzz:
769771
- _xxtestfuzz/_xxtestfuzz.c
770772
- _xxtestfuzz/fuzzer.c
771773

774+
_zstd:
775+
# Disable on all targets until we add a zstd library
776+
disabled-targets:
777+
- .*
778+
minimum-python-version: '3.14'
779+
sources:
780+
- _zstd/_zstdmodule.c
781+
- _zstd/zdict.c
782+
- _zstd/compressor.c
783+
- _zstd/decompressor.c
784+
772785
_zoneinfo:
773786
minimum-python-version: "3.9"
774787
sources:
Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/Tools/jit/_targets.py b/Tools/jit/_targets.py
2-
index b3b065652e0..d361f57382e 100644
2+
index 6ceb4404e74..94b74b5c8b0 100644
33
--- a/Tools/jit/_targets.py
44
+++ b/Tools/jit/_targets.py
55
@@ -10,6 +10,7 @@
@@ -10,15 +10,15 @@ index b3b065652e0..d361f57382e 100644
1010

1111
import _llvm
1212
import _schema
13-
@@ -42,6 +43,7 @@ class _Target(typing.Generic[_S, _R]):
13+
@@ -46,6 +47,7 @@ class _Target(typing.Generic[_S, _R]):
1414
stable: bool = False
1515
debug: bool = False
1616
verbose: bool = False
1717
+ cflags: str = ""
1818
known_symbols: dict[str, int] = dataclasses.field(default_factory=dict)
1919

2020
def _get_nop(self) -> bytes:
21-
@@ -115,6 +117,7 @@ async def _compile(
21+
@@ -119,6 +121,7 @@ async def _compile(
2222
) -> _stencils.StencilGroup:
2323
o = tempdir / f"{opname}.o"
2424
args = [
@@ -27,44 +27,48 @@ index b3b065652e0..d361f57382e 100644
2727
"-DPy_BUILD_CORE_MODULE",
2828
"-D_DEBUG" if self.debug else "-DNDEBUG",
2929
diff --git a/Tools/jit/build.py b/Tools/jit/build.py
30-
index a8cb0f67c36..663874ad439 100644
30+
index 49b08f477db..49a1b11de47 100644
3131
--- a/Tools/jit/build.py
3232
+++ b/Tools/jit/build.py
33-
@@ -22,7 +22,11 @@
33+
@@ -26,11 +26,15 @@
3434
parser.add_argument(
3535
"-v", "--verbose", action="store_true", help="echo commands as they are run"
3636
)
3737
+ parser.add_argument(
3838
+ "--with-cflags", help="additional flags to pass to the compiler", default=""
3939
+ )
4040
args = parser.parse_args()
41-
args.target.debug = args.debug
42-
args.target.verbose = args.verbose
43-
+ args.target.cflags = args.with_cflags
44-
args.target.build(pathlib.Path.cwd(), comment=comment, force=args.force)
41+
for target in args.target:
42+
target.debug = args.debug
43+
target.force = args.force
44+
target.verbose = args.verbose
45+
+ target.cflags = args.with_cflags
46+
target.build(
47+
out,
48+
comment=comment,
4549
diff --git a/configure b/configure
46-
index 1b75ddfa26d..3c9e550b5d3 100755
50+
index c51192f12c8..0dcef7c2617 100755
4751
--- a/configure
4852
+++ b/configure
49-
@@ -8399,7 +8399,7 @@ then :
53+
@@ -10863,7 +10863,7 @@ then :
5054

5155
else case e in #(
5256
e) as_fn_append CFLAGS_NODIST " $jit_flags"
53-
- REGEN_JIT_COMMAND="\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py $host"
54-
+ REGEN_JIT_COMMAND="\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py $host --with-cflags=\"\$(CONFIGURE_CFLAGS)\""
57+
- REGEN_JIT_COMMAND="\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host}"
58+
+ REGEN_JIT_COMMAND="\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --with-cflags=\"\$(CONFIGURE_CFLAGS)\""
5559
JIT_STENCILS_H="jit_stencils.h"
5660
if test "x$Py_DEBUG" = xtrue
5761
then :
5862
diff --git a/configure.ac b/configure.ac
59-
index c449bb5ebb3..5f9d08a4ee7 100644
63+
index a7b2f62579b..5998f896a4e 100644
6064
--- a/configure.ac
6165
+++ b/configure.ac
62-
@@ -1827,7 +1827,7 @@ AS_VAR_IF([jit_flags],
66+
@@ -2776,7 +2776,7 @@ AS_VAR_IF([jit_flags],
6367
[],
6468
[AS_VAR_APPEND([CFLAGS_NODIST], [" $jit_flags"])
6569
AS_VAR_SET([REGEN_JIT_COMMAND],
66-
- ["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py $host"])
67-
+ ["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py $host --with-cflags=\"\$(CONFIGURE_CFLAGS)\""])
70+
- ["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host}"])
71+
+ ["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --with-cflags=\"\$(CONFIGURE_CFLAGS)\""])
6872
AS_VAR_SET([JIT_STENCILS_H], ["jit_stencils.h"])
6973
AS_VAR_IF([Py_DEBUG],
7074
[true],
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
diff --git a/configure.ac b/configure.ac
2+
index a7b2f62579b..06c0c0c0da0 100644
3+
--- a/configure.ac
4+
+++ b/configure.ac
5+
@@ -7897,8 +7897,7 @@ AC_SUBST([LIBHACL_LDFLAGS])
6+
# The SIMD files use aligned_alloc, which is not available on older versions of
7+
# Android.
8+
# The *mmintrin.h headers are x86-family-specific, so can't be used on WASI.
9+
-if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || \
10+
- { test -n "$ANDROID_API_LEVEL" && test "$ANDROID_API_LEVEL" -ge 28; }
11+
+if false
12+
then
13+
dnl This can be extended here to detect e.g. Power8, which HACL* should also support.
14+
AX_CHECK_COMPILE_FLAG([-msse -msse2 -msse3 -msse4.1 -msse4.2],[
15+
@@ -7930,8 +7929,7 @@ AC_SUBST([LIBHACL_BLAKE2_SIMD128_OBJS])
16+
# Although AVX support is not guaranteed on Android
17+
# (https://developer.android.com/ndk/guides/abis#86-64), this is safe because we do a
18+
# runtime CPUID check.
19+
-if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || \
20+
- { test -n "$ANDROID_API_LEVEL" && test "$ANDROID_API_LEVEL" -ge 28; }
21+
+if false
22+
then
23+
AX_CHECK_COMPILE_FLAG([-mavx2],[
24+
[LIBHACL_SIMD256_FLAGS="-mavx2"]

cpython-windows/build.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@
7272
},
7373
"_overlapped": {},
7474
"_multiprocessing": {},
75+
"_remote_debugging": {
76+
# Added in 3.14
77+
"ignore_missing": True
78+
},
7579
"_socket": {},
7680
"_sqlite3": {"shared_depends": ["sqlite3"]},
7781
# See the one-off calls to copy_link_to_lib() and elsewhere to hack up
@@ -90,6 +94,10 @@
9094
"ignore_missing": True,
9195
},
9296
"_zoneinfo": {"ignore_missing": True},
97+
"_zstd": {
98+
# Added in 3.14
99+
"ignore_missing": True
100+
},
93101
"pyexpat": {},
94102
"select": {},
95103
"unicodedata": {},
@@ -117,6 +125,7 @@
117125
"_tkinter": ["tcl-8612", "tk-8612", "tix"],
118126
"_uuid": ["uuid"],
119127
"zlib": ["zlib"],
128+
"_zstd": ["zstd"],
120129
}
121130

122131

@@ -357,6 +366,7 @@ def hack_props(
357366
sqlite_version = DOWNLOADS["sqlite"]["version"]
358367
xz_version = DOWNLOADS["xz"]["version"]
359368
zlib_version = DOWNLOADS[zlib_entry]["version"]
369+
zstd_version = DOWNLOADS["zstd"]["version"]
360370

361371
mpdecimal_version = DOWNLOADS["mpdecimal"]["version"]
362372

@@ -372,6 +382,7 @@ def hack_props(
372382
xz_path = td / ("xz-%s" % xz_version)
373383
zlib_prefix = "cpython-source-deps-" if zlib_entry == "zlib-ng" else ""
374384
zlib_path = td / ("%s%s-%s" % (zlib_prefix, zlib_entry, zlib_version))
385+
zstd_path = td / ("cpython-source-deps-zstd-%s" % zstd_version)
375386
mpdecimal_path = td / ("mpdecimal-%s" % mpdecimal_version)
376387

377388
openssl_root = td / "openssl" / arch
@@ -416,6 +427,9 @@ def hack_props(
416427
elif b"<zlibNgDir" in line:
417428
line = b"<zlibNgDir>%s\\</zlibNgDir>" % zlib_path
418429

430+
elif b"<zstdDir" in line:
431+
line = b"<zstdDir>%s\\</zstdDir>" % zstd_path
432+
419433
elif b"<mpdecimalDir" in line:
420434
line = b"<mpdecimalDir>%s\\</mpdecimalDir>" % mpdecimal_path
421435

@@ -1255,6 +1269,12 @@ def build_cpython(
12551269
"tk-windows-bin-8612", BUILD, local_name="tk-windows-bin.tar.gz"
12561270
)
12571271

1272+
# On CPython 3.14+, zstd is included
1273+
if meets_python_minimum_version(python_version, "3.14"):
1274+
zstd_archive = download_entry("zstd", BUILD)
1275+
else:
1276+
zstd_archive = None
1277+
12581278
# CPython 3.13+ no longer uses a bundled `mpdecimal` version so we build it
12591279
if meets_python_minimum_version(python_version, "3.13"):
12601280
mpdecimal_archive = download_entry("mpdecimal", BUILD)
@@ -1297,6 +1317,7 @@ def build_cpython(
12971317
tk_bin_archive,
12981318
xz_archive,
12991319
zlib_archive,
1320+
zstd_archive,
13001321
):
13011322
if a is None:
13021323
continue

pythonbuild/cpython.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@
1616
"properties": {
1717
"build-mode": {"type": "string"},
1818
"config-c-only": {"type": "boolean"},
19+
"config-c-only-conditional": {
20+
"type": "array",
21+
"items": {
22+
"type": "object",
23+
"properties": {
24+
"config-c-only": {"type": "boolean"},
25+
"minimum-python-version": {"type": "string"},
26+
"maximum-python-version": {"type": "string"},
27+
},
28+
"additionalProperties": False,
29+
"required": ["config-c-only"],
30+
},
31+
},
1932
"defines": {"type": "array", "items": {"type": "string"}},
2033
"defines-conditional": {
2134
"type": "array",
@@ -286,6 +299,18 @@ def derive_setup_local(
286299
if info.get("config-c-only"):
287300
config_c_only_wanted.add(name)
288301

302+
for entry in info.get("config-c-only-conditional", []):
303+
python_min_match_setup = meets_python_minimum_version(
304+
python_version, entry.get("minimum-python-version", "1.0")
305+
)
306+
python_max_match_setup = meets_python_maximum_version(
307+
python_version, entry.get("maximum-python-version", "100.0")
308+
)
309+
if entry.get("config-c-only", False) and (
310+
python_min_match_setup and python_max_match_setup
311+
):
312+
config_c_only_wanted.add(name)
313+
289314
# Parse more files in the distribution for their metadata.
290315

291316
with tarfile.open(str(cpython_source_archive)) as tf:

pythonbuild/downloads.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@
8282
"python_tag": "cp313",
8383
},
8484
"cpython-3.14": {
85-
"url": "https://www.python.org/ftp/python/3.14.0/Python-3.14.0a7.tar.xz",
86-
"size": 23015952,
87-
"sha256": "71adbcec3ac9edf93308e55cfb4184f2eb4b16fda2bb0a5a382929ed29c8386d",
88-
"version": "3.14.0a7",
85+
"url": "https://www.python.org/ftp/python/3.14.0/Python-3.14.0b1.tar.xz",
86+
"size": 23358200,
87+
"sha256": "2ddd30a77c9f62e065ce648664a254b9b0c011bcdaa8c1c2787087e644cbeb39",
88+
"version": "3.14.0b1",
8989
"licenses": ["Python-2.0", "CNRI-Python"],
9090
"license_file": "LICENSE.cpython.txt",
9191
"python_tag": "cp314",
@@ -429,4 +429,13 @@
429429
"licenses": ["Zlib"],
430430
"license_file": "LICENSE.zlib-ng.txt",
431431
},
432+
"zstd": {
433+
"url": "https://github.com/python/cpython-source-deps/archive/refs/tags/zstd-1.5.7.tar.gz",
434+
"size": 2440298,
435+
"sha256": "f24b52470d12f466e9fa4fcc94e6c530625ada51d7b36de7fdc6ed7e6f499c8e",
436+
"version": "1.5.7",
437+
"library_names": ["zstd"],
438+
"licenses": ["BSD-3-Clause"],
439+
"license_file": "LICENSE.zstd.txt",
440+
},
432441
}

0 commit comments

Comments
 (0)