[Python-checkins] r73666 - python/branches/py3k/Lib/base64.py

alexandre.vassalotti python-checkins at python.org
Mon Jun 29 03:13:42 CEST 2009


Author: alexandre.vassalotti
Date: Mon Jun 29 03:13:41 2009
New Revision: 73666

Log:
Make b64encode raises properly a TypeError when altchars is not bytes.


Modified:
   python/branches/py3k/Lib/base64.py

Modified: python/branches/py3k/Lib/base64.py
==============================================================================
--- python/branches/py3k/Lib/base64.py	(original)
+++ python/branches/py3k/Lib/base64.py	Mon Jun 29 03:13:41 2009
@@ -58,8 +58,8 @@
     encoded = binascii.b2a_base64(s)[:-1]
     if altchars is not None:
         if not isinstance(altchars, bytes_types):
-            altchars = TypeError("expected bytes, not %s"
-                                 % altchars.__class__.__name__)
+            raise TypeError("expected bytes, not %s"
+                            % altchars.__class__.__name__)
         assert len(altchars) == 2, repr(altchars)
         return _translate(encoded, {'+': altchars[0:1], '/': altchars[1:2]})
     return encoded


More information about the Python-checkins mailing list