Skip to content

Commit 829b991

Browse files
committed
Fixed test_urllib2 by coercing Message object to str
before passing it to io.StringIO.write().
1 parent ab82a97 commit 829b991

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/urllib2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1295,7 +1295,7 @@ def ftp_open(self, req):
12951295
if retrlen is not None and retrlen >= 0:
12961296
headers += "Content-length: %d\n" % retrlen
12971297
headers = email.message_from_string(headers)
1298-
sf = StringIO(headers)
1298+
sf = StringIO(str(headers))
12991299
return addinfourl(fp, headers, req.get_full_url())
13001300
except ftplib.all_errors as msg:
13011301
raise URLError('ftp error: %s' % msg).with_traceback(sys.exc_info()[2])

0 commit comments

Comments
 (0)