Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit decc317

Browse files
committed
Merge pull request #866 from cgohlke/patch-2
Fix addinfourl call on Py3
2 parents 91310f8 + 95f4c9a commit decc317

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/matplotlib/cbook.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def addinfourl(data, headers, url, code=None):
3737
def urllib_quote():
3838
return urllib2.quote
3939
def addinfourl(data, headers, url, code=None):
40-
return urllib2.addinfourl(io.StringIO(data),
40+
return urllib2.addinfourl(io.BytesIO(data),
4141
headers, url, code)
4242
urllib_HTTPSHandler = urllib2.HTTPSHandler
4343
urllib_build_opener = urllib2.build_opener
@@ -639,7 +639,7 @@ def https_response(self, req, response):
639639
else:
640640
data = response.read()
641641
self.cache_file(req.get_full_url(), data, response.headers)
642-
result = addinfourl(StringIO.StringIO(data),
642+
result = addinfourl(data,
643643
response.headers,
644644
req.get_full_url())
645645
result.code = response.code

0 commit comments

Comments
 (0)