[Python-checkins] python/dist/src/Lib urllib2.py,1.57,1.58
jhylton at users.sourceforge.net
jhylton at users.sourceforge.net
Mon Dec 15 11:08:54 EST 2003
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv25038
Modified Files:
urllib2.py
Log Message:
Remove __del__ methods to avoid creating uncollectable cyclic trash.
Keep close() methods for backwards compatibility.
Does any call close() explicitly?
Index: urllib2.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -d -r1.57 -r1.58
*** urllib2.py 14 Dec 2003 05:27:34 -0000 1.57
--- urllib2.py 15 Dec 2003 16:08:48 -0000 1.58
***************
*** 171,180 ****
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
--- 171,174 ----
***************
*** 308,318 ****
handler.add_parent(self)
- def __del__(self):
- self.close()
-
def close(self):
! for handler in self.handlers:
! handler.close()
! self.handlers = []
def _call_chain(self, chain, kind, meth_name, *args):
--- 302,308 ----
handler.add_parent(self)
def close(self):
! # Only exists for backwards compatibility.
! pass
def _call_chain(self, chain, kind, meth_name, *args):
***************
*** 437,441 ****
def close(self):
! self.parent = None
def __lt__(self, other):
--- 427,432 ----
def close(self):
! # Only exists for backwards compatibility
! pass
def __lt__(self, other):
More information about the Python-checkins
mailing list