Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(88503)

Unified Diff: Lib/base64.py

Issue 25357: Add an optional newline parameter to binascii.b2a_base64() to not add a newline
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
--- a/Lib/base64.py Fri Oct 09 13:10:05 2015 +0200
+++ b/Lib/base64.py Fri Oct 09 19:05:11 2015 +0200
@@ -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))

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+