Author: Armin Rigo <[email protected]>
Branch: gc-incminimark-pinning
Changeset: r74067:ea490b011329
Date: 2014-10-22 11:34 +0200
http://bitbucket.org/pypy/pypy/changeset/ea490b011329/

Log:    "Fix" the issue of weakrefs to pinned objects by writing why we
        really shouldn't get any weakref to pinned objects.

diff --git a/rpython/memory/gc/incminimark.py b/rpython/memory/gc/incminimark.py
--- a/rpython/memory/gc/incminimark.py
+++ b/rpython/memory/gc/incminimark.py
@@ -2517,6 +2517,11 @@
                     (obj + offset).address[0] = self.get_forwarding_address(
                         pointing_to)
                 else:
+                    # If the target is pinned, then we reach this point too.
+                    # It means that a hypothetical RPython interpreter that
+                    # would let you take a weakref to a pinned object (strange
+                    # thing not possible at all in PyPy) might see these
+                    # weakrefs marked as dead too early.
                     (obj + offset).address[0] = llmemory.NULL
                     continue    # no need to remember this weakref any longer
             #
diff --git a/rpython/memory/test/test_incminimark_gc.py 
b/rpython/memory/test/test_incminimark_gc.py
--- a/rpython/memory/test/test_incminimark_gc.py
+++ b/rpython/memory/test/test_incminimark_gc.py
@@ -1,3 +1,4 @@
+import py
 from rpython.rtyper.lltypesystem import lltype
 from rpython.rtyper.lltypesystem.lloperation import llop
 from rpython.rlib import rgc
@@ -67,6 +68,7 @@
         self.interpret(f, [])
 
     def test_weakref_to_pinned(self):
+        py.test.skip("weakref to pinned object: not supported")
         import weakref
         from rpython.rlib import rgc
         class A(object):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to