summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2003-12-15 16:08:48 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2003-12-15 16:08:48 (GMT)
commitdce391cb398f4ce266d98130d10810a6a36617b3 (patch)
tree93572875f531e02f98e4bcb3cf8813ce7493ebc6 /Lib
parent6485a87b9a0ce2cd0c11310bfac302989ea1ce80 (diff)
downloadcpython-dce391cb398f4ce266d98130d10810a6a36617b3.zip
cpython-dce391cb398f4ce266d98130d10810a6a36617b3.tar.gz
cpython-dce391cb398f4ce266d98130d10810a6a36617b3.tar.bz2
Remove __del__ methods to avoid creating uncollectable cyclic trash.
Keep close() methods for backwards compatibility. Does any call close() explicitly?
Diffstat (limited to 'Lib')
-rw-r--r--Lib/urllib2.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index 3fbb5e3..35a46be 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -170,12 +170,6 @@ class HTTPError(URLError, addinfourl):
def __str__(self):
return 'HTTP Error %s: %s' % (self.code, self.msg)
- def __del__(self):
- # XXX is this safe? what if user catches exception, then
- # extracts fp and discards exception?
- if self.fp:
- self.fp.close()
-
class GopherError(URLError):
pass
@@ -307,13 +301,9 @@ class OpenerDirector:
bisect.insort(self.handlers, handler)
handler.add_parent(self)
- def __del__(self):
- self.close()
-
def close(self):
- for handler in self.handlers:
- handler.close()
- self.handlers = []
+ # Only exists for backwards compatibility.
+ pass
def _call_chain(self, chain, kind, meth_name, *args):
# XXX raise an exception if no one else should try to handle
@@ -436,7 +426,8 @@ class BaseHandler:
self.parent = parent
def close(self):
- self.parent = None
+ # Only exists for backwards compatibility
+ pass
def __lt__(self, other):
if not hasattr(other, "handler_order"):