[pypy-svn] r72372 - in pypy/trunk/pypy: rpython/lltypesystem rpython/lltypesystem/test translator
xoraxax at codespeak.net
xoraxax at codespeak.net
Thu Mar 18 14:37:06 CET 2010
Author: xoraxax
Date: Thu Mar 18 14:37:04 2010
New Revision: 72372
Modified:
pypy/trunk/pypy/rpython/lltypesystem/lltype.py
pypy/trunk/pypy/rpython/lltypesystem/test/test_lltype.py
pypy/trunk/pypy/translator/geninterplevel.py
Log:
Fix geninterp and use identity_dict in dissect_ll_instance.
Modified: pypy/trunk/pypy/rpython/lltypesystem/lltype.py
==============================================================================
--- pypy/trunk/pypy/rpython/lltypesystem/lltype.py (original)
+++ pypy/trunk/pypy/rpython/lltypesystem/lltype.py Thu Mar 18 14:37:04 2010
@@ -5,6 +5,7 @@
from pypy.rlib.objectmodel import Symbolic
from pypy.tool.uid import Hashable
from pypy.tool.tls import tlsobject
+from pypy.lib.identity_dict import identity_dict
from types import NoneType
from sys import maxint
import struct
@@ -1935,10 +1936,10 @@
def dissect_ll_instance(v, t=None, memo=None):
if memo is None:
- memo = {}
- if id(v) in memo:
+ memo = identity_dict()
+ if v in memo:
return
- memo[id(v)] = True # could use an identity dict if there wasnt the parameter
+ memo[v] = True
if t is None:
t = typeOf(v)
yield t, v
Modified: pypy/trunk/pypy/rpython/lltypesystem/test/test_lltype.py
==============================================================================
--- pypy/trunk/pypy/rpython/lltypesystem/test/test_lltype.py (original)
+++ pypy/trunk/pypy/rpython/lltypesystem/test/test_lltype.py Thu Mar 18 14:37:04 2010
@@ -1,4 +1,5 @@
from pypy.rpython.lltypesystem.lltype import *
+from pypy.lib.identity_dict import identity_dict
def isweak(p, T):
try:
@@ -620,7 +621,7 @@
b_expected = [(Ptr(B), b), (B, b._obj)]
assert list(dissect_ll_instance(b)) == b_expected + r_expected
- memo = {}
+ memo = identity_dict()
assert list(dissect_ll_instance(r, None, memo)) == r_expected
assert list(dissect_ll_instance(b, None, memo)) == b_expected
Modified: pypy/trunk/pypy/translator/geninterplevel.py
==============================================================================
--- pypy/trunk/pypy/translator/geninterplevel.py (original)
+++ pypy/trunk/pypy/translator/geninterplevel.py Thu Mar 18 14:37:04 2010
@@ -195,10 +195,10 @@
return '<%s>' % self.__name__
self.builtin_ids = identity_dict()
- self.builtin_ids.update(dict( [
+ self.builtin_ids.update([
(value, bltinstub(key))
for key, value in __builtin__.__dict__.items()
- if callable(value) and type(value) not in [types.ClassType, type] ] ))
+ if callable(value) and type(value) not in [types.ClassType, type] ] )
self.space = FlowObjSpace() # for introspection
More information about the Pypy-commit
mailing list