[pypy-commit] pypy lightweight-finalizers: don't call close on socket, instead almost copy the logic. The idea is that

fijal noreply at buildbot.pypy.org
Sun Oct 9 01:32:23 CEST 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: lightweight-finalizers
Changeset: r47885:d8f5b3366786
Date: 2011-10-09 01:32 +0200
http://bitbucket.org/pypy/pypy/changeset/d8f5b3366786/

Log:	don't call close on socket, instead almost copy the logic. The idea
	is that we should not raise from an RPython level __del__

diff --git a/pypy/rlib/rsocket.py b/pypy/rlib/rsocket.py
--- a/pypy/rlib/rsocket.py
+++ b/pypy/rlib/rsocket.py
@@ -610,7 +610,10 @@
         self.timeout = defaults.timeout
         
     def __del__(self):
-        self.close()
+        fd = self.fd
+        if fd != _c.INVALID_SOCKET:
+            self.fd = _c.INVALID_SOCKET
+            _c.socketclose(fd)
 
     if hasattr(_c, 'fcntl'):
         def _setblocking(self, block):


More information about the pypy-commit mailing list