Rename buffer -> bytearray.
diff --git a/Lib/base64.py b/Lib/base64.py
index 18beffc..fc05ea9 100755
--- a/Lib/base64.py
+++ b/Lib/base64.py
@@ -27,13 +27,13 @@
     ]
 
 
-bytes_buffer = (bytes, buffer)  # Types acceptable as binary data
+bytes_types = (bytes, bytearray)  # Types acceptable as binary data
 
 
 def _translate(s, altchars):
-    if not isinstance(s, bytes_buffer):
+    if not isinstance(s, bytes_types):
         raise TypeError("expected bytes, not %s" % s.__class__.__name__)
-    translation = buffer(range(256))
+    translation = bytearray(range(256))
     for k, v in altchars.items():
         translation[ord(k)] = v[0]
     return s.translate(translation)
@@ -52,12 +52,12 @@
 
     The encoded byte string is returned.
     """
-    if not isinstance(s, bytes_buffer):
+    if not isinstance(s, bytes_types):
         s = bytes(s, "ascii")
     # Strip off the trailing newline
     encoded = binascii.b2a_base64(s)[:-1]
     if altchars is not None:
-        if not isinstance(altchars, bytes_buffer):
+        if not isinstance(altchars, bytes_types):
             altchars = bytes(altchars, "ascii")
         assert len(altchars) == 2, repr(altchars)
         return _translate(encoded, {'+': altchars[0:1], '/': altchars[1:2]})
@@ -75,10 +75,10 @@
     s were incorrectly padded or if there are non-alphabet characters
     present in the string.
     """
-    if not isinstance(s, bytes_buffer):
+    if not isinstance(s, bytes_types):
         s = bytes(s)
     if altchars is not None:
-        if not isinstance(altchars, bytes_buffer):
+        if not isinstance(altchars, bytes_types):
             altchars = bytes(altchars, "ascii")
         assert len(altchars) == 2, repr(altchars)
         s = _translate(s, {chr(altchars[0]): b'+', chr(altchars[1]): b'/'})
@@ -147,7 +147,7 @@
 
     s is the byte string to encode.  The encoded byte string is returned.
     """
-    if not isinstance(s, bytes_buffer):
+    if not isinstance(s, bytes_types):
         s = bytes(s)
     quanta, leftover = divmod(len(s), 5)
     # Pad the last quantum with zero bits if necessary
@@ -204,7 +204,7 @@
     the input is incorrectly padded or if there are non-alphabet
     characters present in the input.
     """
-    if not isinstance(s, bytes_buffer):
+    if not isinstance(s, bytes_types):
         s = bytes(s)
     quanta, leftover = divmod(len(s), 8)
     if leftover:
@@ -213,7 +213,7 @@
     # False, or the character to map the digit 1 (one) to.  It should be
     # either L (el) or I (eye).
     if map01:
-        if not isinstance(map01, bytes_buffer):
+        if not isinstance(map01, bytes_types):
             map01 = bytes(map01)
         assert len(map01) == 1, repr(map01)
         s = _translate(s, {b'0': b'O', b'1': map01})
@@ -283,7 +283,7 @@
     s were incorrectly padded or if there are non-alphabet characters
     present in the string.
     """
-    if not isinstance(s, bytes_buffer):
+    if not isinstance(s, bytes_types):
         s = bytes(s)
     if casefold:
         s = s.upper()
@@ -330,7 +330,7 @@
 
     Argument and return value are bytes.
     """
-    if not isinstance(s, bytes_buffer):
+    if not isinstance(s, bytes_types):
         raise TypeError("expected bytes, not %s" % s.__class__.__name__)
     pieces = []
     for i in range(0, len(s), MAXBINSIZE):
@@ -344,7 +344,7 @@
 
     Argument and return value are bytes.
     """
-    if not isinstance(s, bytes_buffer):
+    if not isinstance(s, bytes_types):
         raise TypeError("expected bytes, not %s" % s.__class__.__name__)
     return binascii.a2b_base64(s)