[pypy-commit] pypy gc-del: Not super happy with super_invoke_finalizer in mapdict. It feels like

arigo noreply at buildbot.pypy.org
Sat Aug 10 21:10:31 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: gc-del
Changeset: r66064:bb4ebc09a224
Date: 2013-08-10 20:35 +0200
http://bitbucket.org/pypy/pypy/changeset/bb4ebc09a224/

Log:	Not super happy with super_invoke_finalizer in mapdict. It feels
	like hacking until it works.

diff --git a/pypy/interpreter/typedef.py b/pypy/interpreter/typedef.py
--- a/pypy/interpreter/typedef.py
+++ b/pypy/interpreter/typedef.py
@@ -214,19 +214,21 @@
                     value = func_with_new_name(value, value.func_name)
                 body[key] = value
 
+    super_invoke_finalizer = supercls.invoke_finalizer.im_func
+    if super_invoke_finalizer == W_Root.invoke_finalizer.im_func:
+        super_invoke_finalizer = lambda self: None
+
     if (config.objspace.std.withmapdict and "dict" in features):
         from pypy.objspace.std.mapdict import BaseMapdictObject, ObjectMixin
         add(BaseMapdictObject)
         add(ObjectMixin)
         body["user_overridden_class"] = True
+        body["_super_invoke_finalizer"] = super_invoke_finalizer
+        assert not hasattr(supercls, '_super_invoke_finalizer')
         features = ()
 
     if "user" in features:     # generic feature needed by all subcls
 
-        super_invoke_finalizer = supercls.invoke_finalizer.im_func
-        if super_invoke_finalizer == W_Root.invoke_finalizer.im_func:
-            super_invoke_finalizer = lambda self: None
-
         class Proto(object):
             user_overridden_class = True
 
diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py
--- a/pypy/objspace/std/mapdict.py
+++ b/pypy/objspace/std/mapdict.py
@@ -478,7 +478,8 @@
         self.map = map
 
 class Object(ObjectMixin, BaseMapdictObject, W_Root):
-    pass # mainly for tests
+    # mainly for tests
+    _super_invoke_finalizer = lambda self: None
 
 def get_subclass_of_correct_size(space, cls, w_type):
     assert space.config.objspace.std.withmapdict


More information about the pypy-commit mailing list