[Python-3000-checkins] r58802 - python/branches/py3k-pep3137/Lib/base64.py

guido.van.rossum python-3000-checkins at python.org
Fri Nov 2 21:50:29 CET 2007


Author: guido.van.rossum
Date: Fri Nov  2 21:50:29 2007
New Revision: 58802

Modified:
   python/branches/py3k-pep3137/Lib/base64.py
Log:
Fix simple bytes/buffer issues in base64.py.


Modified: python/branches/py3k-pep3137/Lib/base64.py
==============================================================================
--- python/branches/py3k-pep3137/Lib/base64.py	(original)
+++ python/branches/py3k-pep3137/Lib/base64.py	Fri Nov  2 21:50:29 2007
@@ -28,9 +28,9 @@
 
 
 def _translate(s, altchars):
-    if not isinstance(s, bytes):
+    if not isinstance(s, (bytes, buffer)):
         raise TypeError("expected bytes, not %s" % s.__class__.__name__)
-    translation = bytes(range(256))
+    translation = buffer(range(256))
     for k, v in altchars.items():
         translation[ord(k)] = v[0]
     return s.translate(translation)


More information about the Python-3000-checkins mailing list