https://github.com/python/cpython/commit/5f28e6b818a259253c521305d51841dcf6e4c1f4
commit: 5f28e6b818a259253c521305d51841dcf6e4c1f4
branch: main
author: Joshua Root <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2026-04-16T11:21:23+05:30
summary:

gh-148474: Fix `_Py_hexlify_simd` compilation with older clang (#148475)

files:
A Misc/NEWS.d/next/Build/2026-04-12-22-54-16.gh-issue-148474.ouIO8R.rst
M Python/pystrhex.c

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..d2d2bb62834572
--- /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 :file:`Python/pystrhex.c` with older clang versions.
diff --git a/Python/pystrhex.c b/Python/pystrhex.c
index 14d5719313afd2..645bb013581288 100644
--- a/Python/pystrhex.c
+++ b/Python/pystrhex.c
@@ -67,6 +67,7 @@ _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 v16u8 four = v16u8_splat(4);
     const v16s8 nine = v16s8_splat(9);
 
     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.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to