]> granicus.if.org Git - python/commitdiff
Issue #22088: Merge base64 docs from 3.5
authorMartin Panter <vadmium+py@gmail.com>
Wed, 24 Feb 2016 01:08:43 +0000 (01:08 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Wed, 24 Feb 2016 01:08:43 +0000 (01:08 +0000)
1  2 
Lib/base64.py

diff --cc Lib/base64.py
index eb925cd4c55b91111e016a338cbf8ee3caee8572,e2c597b0ca6b83f53fc36e37285dc8e92c101f7b..ab3b1bf22429f55f9a00179b8eed46585c9fe909
@@@ -49,16 -49,14 +49,13 @@@ def _bytes_from_decode_data(s)
  # Base64 encoding/decoding uses binascii
  
  def b64encode(s, altchars=None):
-     """Encode a byte string using Base64.
+     """Encode the bytes-like object s using Base64 and return a bytes object.
  
-     s is the byte string to encode.  Optional altchars must be a byte
-     string of length 2 which specifies an alternative alphabet for the
-     '+' and '/' characters.  This allows an application to
-     e.g. generate url or filesystem safe Base64 strings.
-     The encoded byte string is returned.
+     Optional altchars should be a byte string of length 2 which specifies an
+     alternative alphabet for the '+' and '/' characters.  This allows an
+     application to e.g. generate url or filesystem safe Base64 strings.
      """
 -    # 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))