]> granicus.if.org Git - python/commitdiff
Fixed test_urllib2 by coercing Message object to str
authorAlexandre Vassalotti <alexandre@peadrop.com>
Thu, 12 Jun 2008 18:02:10 +0000 (18:02 +0000)
committerAlexandre Vassalotti <alexandre@peadrop.com>
Thu, 12 Jun 2008 18:02:10 +0000 (18:02 +0000)
before passing it to io.StringIO.write().

Lib/urllib2.py

index 575bee88268d135c8d78f451789289895f145a1a..4bcd3973092c68fc825d53d297e89274a7f1cb9d 100644 (file)
@@ -1295,7 +1295,7 @@ class FTPHandler(BaseHandler):
             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])