[pypy-svn] r47389 - in pypy/dist/pypy/translator/c: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Oct 11 11:26:36 CEST 2007


Author: cfbolz
Date: Thu Oct 11 11:26:34 2007
New Revision: 47389

Modified:
   pypy/dist/pypy/translator/c/database.py
   pypy/dist/pypy/translator/c/node.py
   pypy/dist/pypy/translator/c/test/test_newgc.py
Log:
hack differently: make sure that the two incarnations of a weakref object are
both in the caches, but point to the same node.


Modified: pypy/dist/pypy/translator/c/database.py
==============================================================================
--- pypy/dist/pypy/translator/c/database.py	(original)
+++ pypy/dist/pypy/translator/c/database.py	Thu Oct 11 11:26:34 2007
@@ -149,7 +149,7 @@
         else:
             raise Exception("don't know about type %r" % (T,))
 
-    def getcontainernode(self, container, _cached=True, **buildkwds):
+    def getcontainernode(self, container, _dont_write_c_code=True, **buildkwds):
         try:
             node = self.containernodes[container]
         except KeyError:
@@ -159,13 +159,14 @@
                     self.gctransformer.consider_constant(T, container)
             nodefactory = ContainerNodeFactory[T.__class__]
             node = nodefactory(self, T, container, **buildkwds)
-            # _cached should only be False for a hack in weakrefnode_factory()
-            if not _cached:
-                return node
             self.containernodes[container] = node
-            self.containerlist.append(node)
+            # _dont_write_c_code should only be False for a hack in
+            # weakrefnode_factory()
+            if not _dont_write_c_code:
+                return node
             kind = getattr(node, 'nodekind', '?')
             self.containerstats[kind] = self.containerstats.get(kind, 0) + 1
+            self.containerlist.append(node)
             if self.completed:
                 assert not node.globalcontainer
                 # non-global containers are found very late, e.g. _subarrays

Modified: pypy/dist/pypy/translator/c/node.py
==============================================================================
--- pypy/dist/pypy/translator/c/node.py	(original)
+++ pypy/dist/pypy/translator/c/node.py	Thu Oct 11 11:26:34 2007
@@ -938,7 +938,7 @@
     ptarget = obj._dereference()
     wrapper = db.gcpolicy.convert_weakref_to(ptarget)
     container = wrapper._obj
-    return db.getcontainernode(container, _cached=False)
+    return db.getcontainernode(container, _dont_write_c_code=False)
 
 
 ContainerNodeFactory = {

Modified: pypy/dist/pypy/translator/c/test/test_newgc.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_newgc.py	(original)
+++ pypy/dist/pypy/translator/c/test/test_newgc.py	Thu Oct 11 11:26:34 2007
@@ -827,9 +827,3 @@
 class TestSemiSpaceGC(TestUsingFramework):
     frameworkgc = "semispace"
     should_be_moving = True
-
-    def test_weakref(self):
-        py.test.skip("in-progress")
-
-    def test_prebuilt_weakref(self):
-        py.test.skip("in-progress")



More information about the Pypy-commit mailing list