From bbe143cb8ebdff515ec804cad82e189e04243c0c Mon Sep 17 00:00:00 2001 From: Joshua Root Date: Mon, 13 Apr 2026 08:42:50 +1000 Subject: [PATCH 1/4] gh-148474: Fix _Py_hexlify_simd compilation with older clang Apple clang prior to around Xcode 9 does not automatically generate a vector from a scalar shift operator RHS in this case. Doing it explicitly works with all versions and arguably also makes it clearer what is actually happening. --- Python/pystrhex.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Python/pystrhex.c b/Python/pystrhex.c index 14d5719313afd2..9baec6a2289238 100644 --- a/Python/pystrhex.c +++ b/Python/pystrhex.c @@ -68,6 +68,7 @@ _Py_hexlify_simd(const unsigned char *src, Py_UCS1 *dst, Py_ssize_t len) const v16u8 ascii_0 = v16u8_splat('0'); const v16u8 offset = v16u8_splat('a' - '0' - 10); /* 0x27 */ const v16s8 nine = v16s8_splat(9); + const v16u8 four = v16u8_splat(4); Py_ssize_t i = 0; @@ -78,7 +79,7 @@ _Py_hexlify_simd(const unsigned char *src, Py_UCS1 *dst, Py_ssize_t len) memcpy(&data, src + i, 16); /* Extract high and low nibbles using vector operators */ - v16u8 hi = (data >> 4) & mask_0f; + v16u8 hi = (data >> four) & mask_0f; v16u8 lo = data & mask_0f; /* Compare > 9 using signed comparison for efficient codegen. From a376f713952afb8182663b2672618326464f6c38 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sun, 12 Apr 2026 22:54:23 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Build/2026-04-12-22-54-16.gh-issue-148474.ouIO8R.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Build/2026-04-12-22-54-16.gh-issue-148474.ouIO8R.rst diff --git a/Misc/NEWS.d/next/Build/2026-04-12-22-54-16.gh-issue-148474.ouIO8R.rst b/Misc/NEWS.d/next/Build/2026-04-12-22-54-16.gh-issue-148474.ouIO8R.rst new file mode 100644 index 00000000000000..cea4b57eef3c0c --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-04-12-22-54-16.gh-issue-148474.ouIO8R.rst @@ -0,0 +1 @@ +Fixed compilation of _Py_hexlify_simd with older clang versions. From ce91bec2f64aa35f1ae54c7f0db3483f5809734b Mon Sep 17 00:00:00 2001 From: Joshua Root Date: Mon, 13 Apr 2026 11:54:37 +1000 Subject: [PATCH 3/4] Define four before nine --- Python/pystrhex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/pystrhex.c b/Python/pystrhex.c index 9baec6a2289238..645bb013581288 100644 --- a/Python/pystrhex.c +++ b/Python/pystrhex.c @@ -67,8 +67,8 @@ _Py_hexlify_simd(const unsigned char *src, Py_UCS1 *dst, Py_ssize_t len) const v16u8 mask_0f = v16u8_splat(0x0f); const v16u8 ascii_0 = v16u8_splat('0'); const v16u8 offset = v16u8_splat('a' - '0' - 10); /* 0x27 */ - const v16s8 nine = v16s8_splat(9); const v16u8 four = v16u8_splat(4); + const v16s8 nine = v16s8_splat(9); Py_ssize_t i = 0; From 6799286d673c971f2c2bc24c8dac080aec443586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Mon, 13 Apr 2026 14:06:09 +0200 Subject: [PATCH 4/4] Update Misc/NEWS.d/next/Build/2026-04-12-22-54-16.gh-issue-148474.ouIO8R.rst --- .../next/Build/2026-04-12-22-54-16.gh-issue-148474.ouIO8R.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Build/2026-04-12-22-54-16.gh-issue-148474.ouIO8R.rst b/Misc/NEWS.d/next/Build/2026-04-12-22-54-16.gh-issue-148474.ouIO8R.rst index cea4b57eef3c0c..d2d2bb62834572 100644 --- a/Misc/NEWS.d/next/Build/2026-04-12-22-54-16.gh-issue-148474.ouIO8R.rst +++ b/Misc/NEWS.d/next/Build/2026-04-12-22-54-16.gh-issue-148474.ouIO8R.rst @@ -1 +1 @@ -Fixed compilation of _Py_hexlify_simd with older clang versions. +Fixed compilation of :file:`Python/pystrhex.c` with older clang versions.