summaryrefslogtreecommitdiffstats
path: root/Lib/email
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2016-09-09 19:09:07 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2016-09-09 19:09:07 (GMT)
commit2a2becc1d10c1b4ae1d55720f5bdb54097fed1a4 (patch)
treec6b50c5f481e1aa6c75c26aa044df80f7e79f89c /Lib/email
parent06aed90a1fe6fa48919ff0f1f39181e886df9efc (diff)
parent6ceda631af2717c271e0b5b2b05a036463764418 (diff)
downloadcpython-2a2becc1d10c1b4ae1d55720f5bdb54097fed1a4.zip
cpython-2a2becc1d10c1b4ae1d55720f5bdb54097fed1a4.tar.gz
cpython-2a2becc1d10c1b4ae1d55720f5bdb54097fed1a4.tar.bz2
Merge with 3.5
Diffstat (limited to 'Lib/email')
-rw-r--r--Lib/email/contentmanager.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/email/contentmanager.py b/Lib/email/contentmanager.py
index 099c314..b904ded 100644
--- a/Lib/email/contentmanager.py
+++ b/Lib/email/contentmanager.py
@@ -126,12 +126,13 @@ def _finalize_set(msg, disposition, filename, cid, params):
msg.set_param(key, value)
-# XXX: This is a cleaned-up version of base64mime.body_encode. It would
-# be nice to drop both this and quoprimime.body_encode in favor of
-# enhanced binascii routines that accepted a max_line_length parameter.
+# XXX: This is a cleaned-up version of base64mime.body_encode (including a bug
+# fix in the calculation of unencoded_bytes_per_line). It would be nice to
+# drop both this and quoprimime.body_encode in favor of enhanced binascii
+# routines that accepted a max_line_length parameter.
def _encode_base64(data, max_line_length):
encoded_lines = []
- unencoded_bytes_per_line = max_line_length * 3 // 4
+ unencoded_bytes_per_line = max_line_length // 4 * 3
for i in range(0, len(data), unencoded_bytes_per_line):
thisline = data[i:i+unencoded_bytes_per_line]
encoded_lines.append(binascii.b2a_base64(thisline).decode('ascii'))