diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-10-11 09:01:02 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-10-11 09:01:02 (GMT) |
commit | e84c97656899750a8e6b01bef2cfc01b31d60220 (patch) | |
tree | df461163e3ade56701a5844d1b1b47e29c887f9f /Lib/base64.py | |
parent | 5df7fddc0c678f10ae6f9995c516dd7091fd6cbc (diff) | |
download | cpython-e84c97656899750a8e6b01bef2cfc01b31d60220.zip cpython-e84c97656899750a8e6b01bef2cfc01b31d60220.tar.gz cpython-e84c97656899750a8e6b01bef2cfc01b31d60220.tar.bz2 |
Issue #25357: Add an optional newline paramer to binascii.b2a_base64().
base64.b64encode() uses it to avoid a memory copy.
Diffstat (limited to 'Lib/base64.py')
-rwxr-xr-x | Lib/base64.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Lib/base64.py b/Lib/base64.py index 640f787..eb925cd 100755 --- a/Lib/base64.py +++ b/Lib/base64.py @@ -58,8 +58,7 @@ def b64encode(s, altchars=None): The encoded byte string is returned. """ - # Strip off the trailing newline - encoded = binascii.b2a_base64(s)[:-1] + encoded = binascii.b2a_base64(s, newline=False) if altchars is not None: assert len(altchars) == 2, repr(altchars) return encoded.translate(bytes.maketrans(b'+/', altchars)) |