Commit 19f44560 authored by Guido van Rossum's avatar Guido van Rossum

Use ``0'' instead of ``None'' to reset the underlying object in close

methods.  Using None causes problems if the destructor is called after
the __builtin__ module has already been destroyed (unfortunately, this
can happen!).  I can't just delete the object because it is actually
tested for (if self._sock: ...).  Setting it to 0 is a bit weird but
works.
parent 8f3c812e
......@@ -27,7 +27,7 @@ class _socketobject:
self._sock = sock
def close(self):
self._sock = None
self._sock = 0
def __del__(self):
self.close()
......@@ -68,7 +68,7 @@ class _fileobject:
if self._sock:
self.flush()
finally:
self._sock = None
self._sock = 0
def __del__(self):
self.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment