[pypy-commit] pypy default: Oups. Revert the previous change and document why it was wrong
arigo
noreply at buildbot.pypy.org
Mon Aug 19 17:10:36 CEST 2013
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r66213:dbfb39c958a1
Date: 2013-08-19 17:09 +0200
http://bitbucket.org/pypy/pypy/changeset/dbfb39c958a1/
Log: Oups. Revert the previous change and document why it was wrong
diff --git a/rpython/rlib/rgc.py b/rpython/rlib/rgc.py
--- a/rpython/rlib/rgc.py
+++ b/rpython/rlib/rgc.py
@@ -343,13 +343,12 @@
return intmask(id(Class))
def cast_gcref_to_int(gcref):
+ # This is meant to be used on cast_instance_to_gcref results.
+ # Don't use this on regular gcrefs obtained e.g. with
+ # lltype.cast_opaque_ptr().
if we_are_translated():
return lltype.cast_ptr_to_int(gcref)
else:
- from rpython.rtyper.lltypesystem.ll2ctypes import _llgcopaque
- if isinstance(gcref._obj, _llgcopaque):
- from rpython.rtyper.lltypesystem import rffi
- return rffi.cast(lltype.Signed, gcref)
return id(gcref._x)
def dump_rpy_heap(fd):
diff --git a/rpython/rlib/test/test_rgc.py b/rpython/rlib/test/test_rgc.py
--- a/rpython/rlib/test/test_rgc.py
+++ b/rpython/rlib/test/test_rgc.py
@@ -228,8 +228,3 @@
x1 = X()
n = rgc.get_rpy_memory_usage(rgc.cast_instance_to_gcref(x1))
assert n >= 8 and n <= 64
-
-def test_cast_gcref_to_int():
- from rpython.rtyper.lltypesystem import rffi
- x = rffi.cast(llmemory.GCREF, 123456)
- assert rgc.cast_gcref_to_int(x) == 123456
More information about the pypy-commit
mailing list