[pypy-commit] pypy default: Fix a "refcount leak" for the socket returned by accept().

arigo noreply at buildbot.pypy.org
Fri May 31 20:39:38 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r64685:8c7733710208
Date: 2013-05-31 20:42 +0200
http://bitbucket.org/pypy/pypy/changeset/8c7733710208/

Log:	Fix a "refcount leak" for the socket returned by accept().

diff --git a/lib-python/2.7/socket.py b/lib-python/2.7/socket.py
--- a/lib-python/2.7/socket.py
+++ b/lib-python/2.7/socket.py
@@ -223,7 +223,9 @@
 
     def accept(self):
         sock, addr = self._sock.accept()
-        return _socketobject(_sock=sock), addr
+        sockobj = _socketobject(_sock=sock)
+        sock._drop()    # already a copy in the _socketobject()
+        return sockobj, addr
     accept.__doc__ = _realsocket.accept.__doc__
 
     def dup(self):


More information about the pypy-commit mailing list