mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Removed addbase.__del__ because it can't work.
If code keeps a reference to self.fp or any of its methods, you don't want to close self.fp just because no explicit reference is kept to self.
This commit is contained in:
parent
ebed45fe0f
commit
9c4585acfa
1 changed files with 6 additions and 2 deletions
|
@ -442,8 +442,12 @@ class addbase:
|
|||
def __repr__(self):
|
||||
return '<%s at %s whose fp = %s>' % (
|
||||
self.__class__.__name__, `id(self)`, `self.fp`)
|
||||
def __del__(self):
|
||||
self.close()
|
||||
# Removed this __del__ because it can't work like this. If a
|
||||
# reference is kept to self.fp or any of its methods, but no reference
|
||||
# is kept to self, we don't want to close self.fp (which would happen
|
||||
# if this __del__ still existed).
|
||||
# def __del__(self):
|
||||
# self.close()
|
||||
def close(self):
|
||||
self.read = None
|
||||
self.readline = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue