Author: Armin Rigo <[email protected]>
Branch: gc-del
Changeset: r63613:d8aca814350a
Date: 2013-04-25 18:48 +0200
http://bitbucket.org/pypy/pypy/changeset/d8aca814350a/

Log:    Fixes

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1622,7 +1622,6 @@
     ('get',             'get',       3, ['__get__']),
     ('set',             'set',       3, ['__set__']),
     ('delete',          'delete',    2, ['__delete__']),
-    ('userdel',         'del',       1, ['__del__']),
     ('buffer',          'buffer',    1, ['__buffer__']),   # see buffer.py
     ]
 
diff --git a/pypy/module/_weakref/interp__weakref.py 
b/pypy/module/_weakref/interp__weakref.py
--- a/pypy/module/_weakref/interp__weakref.py
+++ b/pypy/module/_weakref/interp__weakref.py
@@ -354,7 +354,7 @@
 
 proxy_typedef_dict = {}
 callable_proxy_typedef_dict = {}
-special_ops = {'repr': True, 'userdel': True, 'hash': True}
+special_ops = {'repr': True, 'hash': True}
 
 for opname, _, arity, special_methods in ObjSpace.MethodTable:
     if opname in special_ops or not special_methods:
diff --git a/pypy/objspace/descroperation.py b/pypy/objspace/descroperation.py
--- a/pypy/objspace/descroperation.py
+++ b/pypy/objspace/descroperation.py
@@ -466,11 +466,6 @@
             raise OperationError(space.w_TypeError,
                     space.wrap("__hash__() should return an int or long"))
 
-    def userdel(space, w_obj):
-        w_del = space.lookup(w_obj, '__del__')
-        if w_del is not None:
-            space.get_and_call_function(w_del, w_obj)
-
     def cmp(space, w_v, w_w):
 
         if space.is_w(w_v, w_w):
diff --git a/pypy/objspace/std/builtinshortcut.py 
b/pypy/objspace/std/builtinshortcut.py
--- a/pypy/objspace/std/builtinshortcut.py
+++ b/pypy/objspace/std/builtinshortcut.py
@@ -32,7 +32,7 @@
  ])
 
 KNOWN_MISSING = ['getattr',   # mostly non-builtins or optimized by CALL_METHOD
-                 'setattr', 'delattr', 'userdel',  # mostly for non-builtins
+                 'setattr', 'delattr',     # mostly for non-builtins
                  'get', 'set', 'delete',   # uncommon (except on functions)
                  'getslice', 'setslice', 'delslice',  # see below
                  'delitem', 'trunc',              # rare stuff?
diff --git a/pypy/objspace/std/model.py b/pypy/objspace/std/model.py
--- a/pypy/objspace/std/model.py
+++ b/pypy/objspace/std/model.py
@@ -425,7 +425,7 @@
 NOT_MULTIMETHODS = dict.fromkeys(
     ['delattr', 'delete', 'get', 'id', 'inplace_div', 'inplace_floordiv',
      'inplace_lshift', 'inplace_mod', 'inplace_pow', 'inplace_rshift',
-     'inplace_truediv', 'is_', 'set', 'setattr', 'type', 'userdel',
+     'inplace_truediv', 'is_', 'set', 'setattr', 'type',
      'isinstance', 'issubtype'])
 # XXX should we just remove those from the method table or we're happy
 #     with just not having multimethods?
diff --git a/rpython/rlib/rstacklet.py b/rpython/rlib/rstacklet.py
--- a/rpython/rlib/rstacklet.py
+++ b/rpython/rlib/rstacklet.py
@@ -1,6 +1,6 @@
 import sys
 from rpython.rlib import _rffi_stacklet as _c
-from rpython.rlib import jit
+from rpython.rlib import rgc, jit
 from rpython.rlib.objectmodel import we_are_translated
 from rpython.rtyper.lltypesystem import lltype, llmemory
 
@@ -55,13 +55,14 @@
 
 
 class StackletThreadDeleter(object):
-    # quick hack: the __del__ is on another object, so that
+    # quick hack: the finalize() is on another object, so that
     # if the main StackletThread ends up in random circular
     # references, on pypy deletethread() is only called
     # when all that circular reference mess is gone.
     def __init__(self, thrd):
         self._thrd = thrd
-    def __del__(self):
+        rgc.register_finalizer(self.finalize)
+    def finalize(self):
         thrd = self._thrd
         if thrd:
             self._thrd = lltype.nullptr(_c.thread_handle.TO)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to