From 829b99195dade3e835cf50117963cd5b33073717 Mon Sep 17 00:00:00 2001 From: Alexandre Vassalotti Date: Thu, 12 Jun 2008 18:02:10 +0000 Subject: [PATCH] Fixed test_urllib2 by coercing Message object to str before passing it to io.StringIO.write(). --- Lib/urllib2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/urllib2.py b/Lib/urllib2.py index 575bee88268..4bcd3973092 100644 --- a/Lib/urllib2.py +++ b/Lib/urllib2.py @@ -1295,7 +1295,7 @@ def ftp_open(self, req): if retrlen is not None and retrlen >= 0: headers += "Content-length: %d\n" % retrlen headers = email.message_from_string(headers) - sf = StringIO(headers) + sf = StringIO(str(headers)) return addinfourl(fp, headers, req.get_full_url()) except ftplib.all_errors as msg: raise URLError('ftp error: %s' % msg).with_traceback(sys.exc_info()[2])