https://github.com/python/cpython/commit/b6e8088624c078cc0504199cab4e6b328c01bbb9
commit: b6e8088624c078cc0504199cab4e6b328c01bbb9
branch: main
author: Inada Naoki <[email protected]>
committer: methane <[email protected]>
date: 2026-09-11T23:09:24+09:00
summary:

base64: optimize b16decode (#157310)

files:
M Lib/base64.py

diff --git a/Lib/base64.py b/Lib/base64.py
index fa562f74a81034..347807de00d74f 100644
--- a/Lib/base64.py
+++ b/Lib/base64.py
@@ -304,7 +304,8 @@ def b16decode(s, casefold=False, *, ignorechars=b''):
         for b in b'abcdef':
             if b in s and b not in ignorechars:
                 raise binascii.Error('Non-base16 digit found')
-        s = s.translate(None, delete=b'abcdef')
+        if ignorechars:
+            s = s.translate(None, delete=b'abcdef')
     return binascii.unhexlify(s, ignorechars=ignorechars)
 
 #

_______________________________________________
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