diff options
author | Guido van Rossum <guido@python.org> | 1997-11-04 17:32:59 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-11-04 17:32:59 (GMT) |
commit | 19f44560f2387fd0f7e7f6b459510428216b6f79 (patch) | |
tree | 9e8499101ed8e6818c703429952a6fcaa9006753 /Lib/plat-win/socket.py | |
parent | 8f3c812e22d1fc2a70c1f1c2b56262553e8d9c34 (diff) | |
download | cpython-19f44560f2387fd0f7e7f6b459510428216b6f79.zip cpython-19f44560f2387fd0f7e7f6b459510428216b6f79.tar.gz cpython-19f44560f2387fd0f7e7f6b459510428216b6f79.tar.bz2 |
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.
Diffstat (limited to 'Lib/plat-win/socket.py')
-rwxr-xr-x | Lib/plat-win/socket.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/plat-win/socket.py b/Lib/plat-win/socket.py index 7e1b372..645d01e 100755 --- a/Lib/plat-win/socket.py +++ b/Lib/plat-win/socket.py @@ -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() |