Skip to content

Commit 0964f0f

Browse files
zaniebgeofft
andauthored
Bump to 3.14.0a7 (#580)
The big changes here are: - Switching to zlib-ng on Windows (python/cpython#131438) - Using hmac for hashing functions (python/cpython#130157) --------- Co-authored-by: Geoffrey Thomas <[email protected]>
1 parent 0c3baa4 commit 0964f0f

File tree

4 files changed

+73
-18
lines changed

4 files changed

+73
-18
lines changed

cpython-unix/extension-modules.yml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ _blake2:
3838
- Modules/_hacl/include
3939
- Modules/_hacl/internal
4040
minimum-python-version: "3.14"
41-
links-conditional:
42-
- name: :libHacl_Hash_Blake2.a
43-
minimum-python-version: "3.14"
4441
defines-conditional:
4542
- define: _BSD_SOURCE
4643
minimum-python-version: "3.14"
@@ -311,6 +308,25 @@ _heapq:
311308
sources:
312309
- _heapqmodule.c
313310

311+
_hmac:
312+
minimum-python-version: '3.14'
313+
sources:
314+
- hmacmodule.c
315+
- _hacl/Hacl_HMAC.c
316+
- _hacl/Hacl_Streaming_HMAC.c
317+
includes:
318+
- Modules/_hacl/
319+
- Modules/_hacl/include/
320+
links:
321+
- :libHacl_Hash_Blake2.a
322+
- :libHacl_Hash_SHA1.a
323+
- :libHacl_Hash_SHA2.a
324+
- :libHacl_Hash_SHA3.a
325+
- :libHacl_Hash_MD5.a
326+
defines:
327+
- _BSD_SOURCE
328+
- _DEFAULT_SOURCE
329+
314330
_imp:
315331
config-c-only: true
316332

@@ -362,6 +378,7 @@ _md5:
362378
sources-conditional:
363379
- source: _hacl/Hacl_Hash_MD5.c
364380
minimum-python-version: "3.12"
381+
maximum-python-version: "3.13"
365382
defines-conditional:
366383
- define: _BSD_SOURCE
367384
minimum-python-version: "3.12"
@@ -438,6 +455,7 @@ _sha1:
438455
sources-conditional:
439456
- source: _hacl/Hacl_Hash_SHA1.c
440457
minimum-python-version: "3.12"
458+
maximum-python-version: "3.13"
441459
includes:
442460
- Modules/_hacl/include
443461
defines-conditional:
@@ -457,7 +475,9 @@ _sha2:
457475
minimum-python-version: "3.12"
458476
sources:
459477
- sha2module.c
460-
- _hacl/Hacl_Hash_SHA2.c
478+
sources-conditional:
479+
- source: _hacl/Hacl_Hash_SHA2.c
480+
maximum-python-version: "3.13"
461481
includes:
462482
- Modules/_hacl/include
463483
defines:
@@ -471,9 +491,9 @@ _sha3:
471491
maximum-python-version: "3.11"
472492
- source: sha3module.c
473493
minimum-python-version: "3.12"
474-
475494
- source: _hacl/Hacl_Hash_SHA3.c
476495
minimum-python-version: "3.12"
496+
maximum-python-version: "3.13"
477497
includes:
478498
- Modules/_hacl/include
479499
defines-conditional:
@@ -700,6 +720,12 @@ _tracemalloc:
700720
required-targets:
701721
- .*
702722

723+
_types:
724+
minimum-python-version: "3.14"
725+
setup-enabled: true
726+
sources:
727+
- _typesmodule.c
728+
703729
_typing:
704730
minimum-python-version: "3.11"
705731
setup-enabled-conditional:

cpython-windows/build.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ def hack_props(
346346
pcbuild_path: pathlib.Path,
347347
arch: str,
348348
python_version: str,
349+
zlib_entry: str,
349350
):
350351
# TODO can we pass props into msbuild.exe?
351352

@@ -355,7 +356,7 @@ def hack_props(
355356
bzip2_version = DOWNLOADS["bzip2"]["version"]
356357
sqlite_version = DOWNLOADS["sqlite"]["version"]
357358
xz_version = DOWNLOADS["xz"]["version"]
358-
zlib_version = DOWNLOADS["zlib"]["version"]
359+
zlib_version = DOWNLOADS[zlib_entry]["version"]
359360

360361
mpdecimal_version = DOWNLOADS["mpdecimal"]["version"]
361362

@@ -369,7 +370,8 @@ def hack_props(
369370
libffi_path = td / "libffi"
370371
tcltk_path = td / ("cpython-bin-deps-%s" % tcltk_commit)
371372
xz_path = td / ("xz-%s" % xz_version)
372-
zlib_path = td / ("zlib-%s" % zlib_version)
373+
zlib_prefix = "cpython-source-deps-" if zlib_entry == "zlib-ng" else ""
374+
zlib_path = td / ("%s%s-%s" % (zlib_prefix, zlib_entry, zlib_version))
373375
mpdecimal_path = td / ("mpdecimal-%s" % mpdecimal_version)
374376

375377
openssl_root = td / "openssl" / arch
@@ -410,6 +412,10 @@ def hack_props(
410412
elif b"<zlibDir" in line:
411413
line = b"<zlibDir>%s\\</zlibDir>" % zlib_path
412414

415+
# On 3.14+, it's zlib-ng and the name changed
416+
elif b"<zlibNgDir" in line:
417+
line = b"<zlibNgDir>%s\\</zlibNgDir>" % zlib_path
418+
413419
elif b"<mpdecimalDir" in line:
414420
line = b"<mpdecimalDir>%s\\</mpdecimalDir>" % mpdecimal_path
415421

@@ -484,6 +490,7 @@ def hack_project_files(
484490
cpython_source_path: pathlib.Path,
485491
build_directory: str,
486492
python_version: str,
493+
zlib_entry: str,
487494
):
488495
"""Hacks Visual Studio project files to work with our build."""
489496

@@ -494,6 +501,7 @@ def hack_project_files(
494501
pcbuild_path,
495502
build_directory,
496503
python_version,
504+
zlib_entry,
497505
)
498506

499507
# Our SQLite directory is named weirdly. This throws off version detection
@@ -913,6 +921,7 @@ def collect_python_build_artifacts(
913921
arch: str,
914922
config: str,
915923
openssl_entry: str,
924+
zlib_entry: str,
916925
freethreaded: bool,
917926
):
918927
"""Collect build artifacts from Python.
@@ -993,6 +1002,7 @@ def collect_python_build_artifacts(
9931002
depends_projects |= {
9941003
"liblzma",
9951004
"sqlite3",
1005+
"zlib-ng",
9961006
}
9971007

9981008
known_projects = (
@@ -1142,6 +1152,9 @@ def find_additional_dependencies(project: pathlib.Path):
11421152
if name == "openssl":
11431153
name = openssl_entry
11441154

1155+
if name == "zlib":
1156+
name = zlib_entry
1157+
11451158
# On 3.14+, we use the latest tcl/tk version
11461159
if ext == "_tkinter" and python_majmin == "314":
11471160
name = name.replace("-8612", "")
@@ -1213,16 +1226,19 @@ def build_cpython(
12131226
# The python.props file keys off MSBUILD, so it needs to be set.
12141227
os.environ["MSBUILD"] = str(msbuild)
12151228

1216-
bzip2_archive = download_entry("bzip2", BUILD)
1217-
sqlite_archive = download_entry("sqlite", BUILD)
1218-
xz_archive = download_entry("xz", BUILD)
1219-
zlib_archive = download_entry("zlib", BUILD)
1220-
12211229
python_archive = download_entry(python_entry_name, BUILD)
12221230
entry = DOWNLOADS[python_entry_name]
1223-
12241231
python_version = entry["version"]
12251232

1233+
zlib_entry = (
1234+
"zlib-ng" if meets_python_minimum_version(python_version, "3.14") else "zlib"
1235+
)
1236+
1237+
bzip2_archive = download_entry("bzip2", BUILD)
1238+
sqlite_archive = download_entry("sqlite", BUILD)
1239+
xz_archive = download_entry("xz", BUILD)
1240+
zlib_archive = download_entry(zlib_entry, BUILD)
1241+
12261242
setuptools_wheel = download_entry("setuptools", BUILD)
12271243
pip_wheel = download_entry("pip", BUILD)
12281244

@@ -1328,6 +1344,7 @@ def build_cpython(
13281344
cpython_source_path,
13291345
build_directory,
13301346
python_version=python_version,
1347+
zlib_entry=zlib_entry,
13311348
)
13321349

13331350
if pgo:
@@ -1528,6 +1545,7 @@ def build_cpython(
15281545
build_directory,
15291546
artifact_config,
15301547
openssl_entry=openssl_entry,
1548+
zlib_entry=zlib_entry,
15311549
freethreaded=freethreaded,
15321550
)
15331551

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.0a6.tar.xz",
86-
"size": 22956068,
87-
"sha256": "8d6181e5331d9a2cd6ca405ae1230e88589a043f4768ebb443d3889d45c1c35c",
88-
"version": "3.14.0a6",
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",
8989
"licenses": ["Python-2.0", "CNRI-Python"],
9090
"license_file": "LICENSE.cpython.txt",
9191
"python_tag": "cp314",
@@ -446,4 +446,13 @@
446446
"licenses": ["Zlib"],
447447
"license_file": "LICENSE.zlib.txt",
448448
},
449+
"zlib-ng": {
450+
"url": "https://github.com/python/cpython-source-deps/archive/refs/tags/zlib-ng-2.2.4.tar.gz",
451+
"size": 2415819,
452+
"sha256": "00bbd88709bc416cb96160ab61d3e1c8f76e106799af7328d0fe434dc7dd5004",
453+
"version": "2.2.4",
454+
"library_names": ["z"],
455+
"licenses": ["Zlib"],
456+
"license_file": "LICENSE.zlib-ng.txt",
457+
},
449458
}

src/validation.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ const GLOBAL_EXTENSIONS_PYTHON_3_14: &[&str] = &[
763763
"_tokenize",
764764
"_typing",
765765
"_zoneinfo",
766+
"_hmac",
767+
"_types",
766768
];
767769

768770
const GLOBAL_EXTENSIONS_MACOS: &[&str] = &["_scproxy"];
@@ -1596,7 +1598,7 @@ fn validate_extension_modules(
15961598
]);
15971599
}
15981600

1599-
if is_windows && matches!(python_major_minor, "3.13") {
1601+
if is_windows && matches!(python_major_minor, "3.13" | "3.14") {
16001602
wanted.extend(["_suggestions"]);
16011603
}
16021604

0 commit comments

Comments
 (0)