[pypy-commit] pypy default: stub out a method for emitting warnings on implicit closing by __del__
pjenvey
noreply at buildbot.pypy.org
Tue Feb 19 22:18:07 CET 2013
Author: Philip Jenvey <pjenvey at underboss.org>
Branch:
Changeset: r61470:65f3a63f53d0
Date: 2013-02-19 13:17 -0800
http://bitbucket.org/pypy/pypy/changeset/65f3a63f53d0/
Log: stub out a method for emitting warnings on implicit closing by
__del__
diff --git a/rpython/rlib/rsocket.py b/rpython/rlib/rsocket.py
--- a/rpython/rlib/rsocket.py
+++ b/rpython/rlib/rsocket.py
@@ -497,8 +497,15 @@
def __del__(self):
fd = self.fd
if fd != _c.INVALID_SOCKET:
- self.fd = _c.INVALID_SOCKET
- _c.socketclose(fd)
+ try:
+ self._dealloc_warn()
+ finally:
+ self.fd = _c.INVALID_SOCKET
+ _c.socketclose(fd)
+
+ def _dealloc_warn(self):
+ """Called when implicitly closed via the deconstructor"""
+ pass
if hasattr(_c, 'fcntl'):
def _setblocking(self, block):
More information about the pypy-commit
mailing list