[pypy-commit] pypy lightweight-finalizers: use the interface for tests

fijal noreply at buildbot.pypy.org
Sat Oct 1 00:05:30 CEST 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: lightweight-finalizers
Changeset: r47736:155952cafe97
Date: 2011-09-30 19:04 -0300
http://bitbucket.org/pypy/pypy/changeset/155952cafe97/

Log:	use the interface for tests

diff --git a/pypy/rlib/rsocket.py b/pypy/rlib/rsocket.py
--- a/pypy/rlib/rsocket.py
+++ b/pypy/rlib/rsocket.py
@@ -15,6 +15,7 @@
 # app-level code for PyPy.
 
 from pypy.rlib.objectmodel import instantiate, keepalive_until_here
+from pypy.rlib.rgc import owns_raw_memory
 from pypy.rlib import _rsocket_rffi as _c
 from pypy.rlib.rarithmetic import intmask
 from pypy.rpython.lltypesystem import lltype, rffi
@@ -55,6 +56,8 @@
 
 
 _FAMILIES = {}
+
+ at owns_raw_memory('addr_p')
 class Address(object):
     """The base class for RPython-level objects representing addresses.
     Fields:  addr    - a _c.sockaddr_ptr (memory owned by the Address instance)
@@ -75,11 +78,6 @@
         self.addr_p = addr
         self.addrlen = addrlen
 
-    def __del__(self):
-        addr = self.addr_p
-        if addr:
-            lltype.free(addr, flavor='raw')
-
     def setdata(self, addr, addrlen):
         # initialize self.addr and self.addrlen.  'addr' can be a different
         # pointer type than exactly sockaddr_ptr, and we cast it for you.


More information about the pypy-commit mailing list