Commit 829b9919 authored by Alexandre Vassalotti's avatar Alexandre Vassalotti

Fixed test_urllib2 by coercing Message object to str

before passing it to io.StringIO.write().
parent ab82a97b
...@@ -1295,7 +1295,7 @@ class FTPHandler(BaseHandler): ...@@ -1295,7 +1295,7 @@ class FTPHandler(BaseHandler):
if retrlen is not None and retrlen >= 0: if retrlen is not None and retrlen >= 0:
headers += "Content-length: %d\n" % retrlen headers += "Content-length: %d\n" % retrlen
headers = email.message_from_string(headers) headers = email.message_from_string(headers)
sf = StringIO(headers) sf = StringIO(str(headers))
return addinfourl(fp, headers, req.get_full_url()) return addinfourl(fp, headers, req.get_full_url())
except ftplib.all_errors as msg: except ftplib.all_errors as msg:
raise URLError('ftp error: %s' % msg).with_traceback(sys.exc_info()[2]) raise URLError('ftp error: %s' % msg).with_traceback(sys.exc_info()[2])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment