[pypy-commit] pypy gc-del: Progress

arigo noreply at buildbot.pypy.org
Wed Mar 27 20:07:14 CET 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: gc-del
Changeset: r62837:5185bfcb30aa
Date: 2013-03-27 16:45 +0100
http://bitbucket.org/pypy/pypy/changeset/5185bfcb30aa/

Log:	Progress

diff --git a/pypy/interpreter/test/test_typedef.py b/pypy/interpreter/test/test_typedef.py
--- a/pypy/interpreter/test/test_typedef.py
+++ b/pypy/interpreter/test/test_typedef.py
@@ -74,10 +74,10 @@
         sources = []
         for hasdict in [False, True]:
             for wants_slots in [False, True]:
-                for needsdel in [False, True]:
+                if 1:    # was: for needsdel in [False, True]:
                     for weakrefable in [False, True]:
                         print 'Testing case', hasdict, wants_slots,
-                        print needsdel, weakrefable
+                        print weakrefable
                         slots = []
                         checks = []
 
@@ -100,16 +100,7 @@
                         else:
                             checks.append('')
 
-                        if needsdel:
-                            methodname = '__del__'
-                            checks.append('X();X();X();'
-                                          'import gc;gc.collect();'
-                                          'assert seen')
-                        else:
-                            methodname = 'spam'
-                            checks.append('assert "Del" not in irepr')
-
-                        assert len(checks) == 4
+                        assert len(checks) == 3
                         space.appexec([], """():
                             seen = []
                             class X(list):
diff --git a/pypy/interpreter/typedef.py b/pypy/interpreter/typedef.py
--- a/pypy/interpreter/typedef.py
+++ b/pypy/interpreter/typedef.py
@@ -153,11 +153,10 @@
     for flag1 in (False, True):
         for flag2 in (False, True):
             for flag3 in (False, True):
-                for flag4 in (False, True):
-                    result.append(get_unique_interplevel_subclass(
-                        config, cls, flag1, flag2, flag3, flag4))
+                result.append(get_unique_interplevel_subclass(
+                    config, cls, flag1, flag2, flag3))
     result = dict.fromkeys(result)
-    assert len(result) <= 6
+    assert len(result) <= 4
     return result.keys()
 
 def _getusercls(config, cls, wants_dict, wants_slots, weakrefable):
@@ -171,8 +170,8 @@
     if wants_dict:
         if wants_slots:
             # case 3.  Parent class is 1.
-            parentcls = get_unique_interplevel_subclass(config, cls, True, False,
-                                                        False, True)
+            parentcls = get_unique_interplevel_subclass(config, cls,
+                                                        True, False, True)
             return _usersubclswithfeature(config, parentcls, "slots")
         else:
             # case 1 (we need to add weakrefable unless it's already in 'cls')
@@ -183,8 +182,8 @@
     else:
         if weakrefable and not typedef.weakrefable:
             # case 4.  Parent class is 2.
-            parentcls = get_unique_interplevel_subclass(config, cls, False, True,
-                                                        False, False)
+            parentcls = get_unique_interplevel_subclass(config, cls,
+                                                        False, True, False)
             return _usersubclswithfeature(config, parentcls, "weakref")
         else:
             # case 2 (if the base is already weakrefable, case 2 == case 4)
diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -354,14 +354,13 @@
                     # relationship, if any)
                     assert cls in self.model.typeorder, repr(cls)
             #
-            if (self.config.objspace.std.withmapdict and cls is W_ObjectObject
-                    and not w_subtype.needsdel):
+            if self.config.objspace.std.withmapdict and cls is W_ObjectObject:
                 from pypy.objspace.std.mapdict import get_subclass_of_correct_size
                 subcls = get_subclass_of_correct_size(self, cls, w_subtype)
             else:
                 subcls = get_unique_interplevel_subclass(
                         self.config, cls, w_subtype.hasdict, w_subtype.nslots != 0,
-                        w_subtype.needsdel, w_subtype.weakrefable)
+                        w_subtype.weakrefable)
             instance = instantiate(subcls)
             assert isinstance(instance, cls)
             instance.user_setup(self, w_subtype)
diff --git a/pypy/objspace/std/typeobject.py b/pypy/objspace/std/typeobject.py
--- a/pypy/objspace/std/typeobject.py
+++ b/pypy/objspace/std/typeobject.py
@@ -94,7 +94,6 @@
     _immutable_fields_ = ["flag_heaptype",
                           "flag_cpytype",
                           "flag_abstract?",
-                          'needsdel',
                           'weakrefable',
                           'hasdict',
                           'nslots',
@@ -124,7 +123,6 @@
         w_self.dict_w = dict_w
         w_self.nslots = 0
         w_self.hasdict = False
-        w_self.needsdel = False
         w_self.weakrefable = False
         w_self.w_doc = space.w_None
         w_self.weak_subclasses = []
@@ -255,7 +253,7 @@
     # compute a tuple that fully describes the instance layout
     def get_full_instance_layout(w_self):
         w_layout = w_self.w_same_layout_as or w_self
-        return (w_layout, w_self.hasdict, w_self.needsdel, w_self.weakrefable)
+        return (w_layout, w_self.hasdict, w_self.weakrefable)
 
     def compute_default_mro(w_self):
         return compute_C3_mro(w_self.space, w_self)
@@ -658,7 +656,6 @@
             hasoldstylebase = True
             continue
         w_self.hasdict = w_self.hasdict or w_base.hasdict
-        w_self.needsdel = w_self.needsdel or w_base.needsdel
         w_self.weakrefable = w_self.weakrefable or w_base.weakrefable
     w_self.nslots = w_bestbase.nslots
     return hasoldstylebase
@@ -699,8 +696,6 @@
         create_dict_slot(w_self)
     if wantweakref:
         create_weakref_slot(w_self)
-    if '__del__' in dict_w:
-        w_self.needsdel = True
 
 def create_slot(w_self, slot_name):
     space = w_self.space


More information about the pypy-commit mailing list