summaryrefslogtreecommitdiffstats
path: root/Lib/urllib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/urllib')
-rw-r--r--Lib/urllib/request.py2
-rw-r--r--Lib/urllib/response.py7
2 files changed, 6 insertions, 3 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 4d3648d..a501e37 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -1852,7 +1852,7 @@ class URLopener:
if encoding == 'base64':
import base64
# XXX is this encoding/decoding ok?
- data = base64.decodebytes(data.encode('ascii')).decode('latin1')
+ data = base64.decodebytes(data.encode('ascii')).decode('latin-1')
else:
data = unquote(data)
msg.append('Content-Length: %d' % len(data))
diff --git a/Lib/urllib/response.py b/Lib/urllib/response.py
index 9859642..bce2287 100644
--- a/Lib/urllib/response.py
+++ b/Lib/urllib/response.py
@@ -33,12 +33,15 @@ class addbase(object):
id(self), self.fp)
def close(self):
+ if self.fp:
+ self.fp.close()
+ self.fp = None
self.read = None
self.readline = None
self.readlines = None
self.fileno = None
- if self.fp: self.fp.close()
- self.fp = None
+ self.__iter__ = None
+ self.__next__ = None
def __enter__(self):
if self.fp is None: