[Python-checkins] r57925 - python/trunk/Lib/encodings/quopri_codec.py python/trunk/Lib/encodings/uu_codec.py

georg.brandl python-checkins at python.org
Mon Sep 3 09:16:47 CEST 2007


Author: georg.brandl
Date: Mon Sep  3 09:16:46 2007
New Revision: 57925

Modified:
   python/trunk/Lib/encodings/quopri_codec.py
   python/trunk/Lib/encodings/uu_codec.py
Log:
Fix #883466: don't allow Unicode as arguments to quopri and uu codecs.


Modified: python/trunk/Lib/encodings/quopri_codec.py
==============================================================================
--- python/trunk/Lib/encodings/quopri_codec.py	(original)
+++ python/trunk/Lib/encodings/quopri_codec.py	Mon Sep  3 09:16:46 2007
@@ -18,7 +18,8 @@
 
     """
     assert errors == 'strict'
-    f = StringIO(input)
+    # using str() because of cStringIO's Unicode undesired Unicode behavior.
+    f = StringIO(str(input))
     g = StringIO()
     quopri.encode(f, g, 1)
     output = g.getvalue()
@@ -33,7 +34,7 @@
 
     """
     assert errors == 'strict'
-    f = StringIO(input)
+    f = StringIO(str(input))
     g = StringIO()
     quopri.decode(f, g)
     output = g.getvalue()

Modified: python/trunk/Lib/encodings/uu_codec.py
==============================================================================
--- python/trunk/Lib/encodings/uu_codec.py	(original)
+++ python/trunk/Lib/encodings/uu_codec.py	Mon Sep  3 09:16:46 2007
@@ -25,7 +25,8 @@
     assert errors == 'strict'
     from cStringIO import StringIO
     from binascii import b2a_uu
-    infile = StringIO(input)
+    # using str() because of cStringIO's Unicode undesired Unicode behavior.
+    infile = StringIO(str(input))
     outfile = StringIO()
     read = infile.read
     write = outfile.write
@@ -60,7 +61,7 @@
     assert errors == 'strict'
     from cStringIO import StringIO
     from binascii import a2b_uu
-    infile = StringIO(input)
+    infile = StringIO(str(input))
     outfile = StringIO()
     readline = infile.readline
     write = outfile.write


More information about the Python-checkins mailing list