Skip to content

Commit 8028636

Browse files
authored
binascii: newline param in function b2a_base64
1 parent 3167fd5 commit 8028636

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

binascii/binascii.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def a2b_base64(ascii):
8383
table_b2a_base64 = (
8484
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
8585

86-
def b2a_base64(bin):
86+
def b2a_base64(bin, newline=True):
8787
"Base64-code line of data."
8888

8989
newlength = (len(bin) + 2) // 3
@@ -109,5 +109,6 @@ def b2a_base64(bin):
109109
elif leftbits == 4:
110110
res.append(table_b2a_base64[(leftchar & 0xf) << 2])
111111
res.append(PAD)
112-
res.append('\n')
112+
if newline:
113+
res.append('\n')
113114
return ''.join(res).encode('ascii')

0 commit comments

Comments
 (0)