[Python-checkins] cpython: Be more thorough in blanking out methods grabbed off of an fp.

brett.cannon python-checkins at python.org
Tue Mar 15 23:46:08 CET 2011


http://hg.python.org/cpython/rev/30062a3331be
changeset:   68571:30062a3331be
parent:      68559:9050675cb94e
user:        Brett Cannon <brett at python.org>
date:        Tue Mar 15 18:45:13 2011 -0400
summary:
  Be more thorough in blanking out methods grabbed off of an fp.

files:
  Lib/urllib/response.py

diff --git a/Lib/urllib/response.py b/Lib/urllib/response.py
--- a/Lib/urllib/response.py
+++ b/Lib/urllib/response.py
@@ -33,12 +33,15 @@
                                              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:

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list