[pypy-svn] pypy out-of-line-guards: improve ugly hack

fijal commits-noreply at bitbucket.org
Sun Jan 2 11:43:19 CET 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: out-of-line-guards
Changeset: r40317:04a3b6189d70
Date: 2011-01-02 11:57 +0200
http://bitbucket.org/pypy/pypy/changeset/04a3b6189d70/

Log:	improve ugly hack

diff --git a/pypy/rlib/ropaque.py b/pypy/rlib/ropaque.py
--- a/pypy/rlib/ropaque.py
+++ b/pypy/rlib/ropaque.py
@@ -15,7 +15,10 @@
 def cast_obj_to_ropaque(obj):
     if not we_are_translated():
         res = lltype.opaqueptr(ROPAQUE.TO, 'ropaque', _obj=obj)
-        obj._ropaqu_ptr = res # XXX ugly hack for weakrefs
+        if hasattr(obj, '_ropaque_ptrs'):
+            obj._ropaque_ptrs.append(res) # XXX ugly hack for weakrefs
+        else:
+            obj._ropaque_ptrs = [res]
         return res
     else:
         ptr = cast_instance_to_base_ptr(obj)


More information about the Pypy-commit mailing list