[pypy-svn] r16541 - in pypy/dist/pypy/rpython: . test
arigo at codespeak.net
arigo at codespeak.net
Thu Aug 25 20:13:15 CEST 2005
Author: arigo
Date: Thu Aug 25 20:13:13 2005
New Revision: 16541
Modified:
pypy/dist/pypy/rpython/rpbc.py
pypy/dist/pypy/rpython/test/test_rpbc.py
Log:
Crashing on Void fields in MultipleFrozenPBCRepr objects.
Fix and test.
Modified: pypy/dist/pypy/rpython/rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/rpbc.py (original)
+++ pypy/dist/pypy/rpython/rpbc.py Thu Aug 25 20:13:13 2005
@@ -219,6 +219,8 @@
result = malloc(self.pbc_type, immortal=True)
self.pbc_cache[pbc] = result
for attr, (mangled_name, r_value) in self.llfieldmap.items():
+ if r_value.lowleveltype == Void:
+ continue
try:
thisattrvalue = self.access_set.values[(pbc, attr)]
except KeyError:
Modified: pypy/dist/pypy/rpython/test/test_rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rpbc.py (original)
+++ pypy/dist/pypy/rpython/test/test_rpbc.py Thu Aug 25 20:13:13 2005
@@ -823,3 +823,26 @@
except E:
return None
res = interpret(call, [0])
+
+def test_multiple_pbc_with_void_attr():
+ class A:
+ def _freeze_(self):
+ return True
+ a1 = A()
+ a2 = A()
+ unique = A()
+ unique.result = 42
+ a1.value = unique
+ a2.value = unique
+ def g(a):
+ return a.value.result
+ def f(i):
+ if i == 1:
+ a = a1
+ else:
+ a = a2
+ return g(a)
+ res = interpret(f, [0])
+ assert res == 42
+ res = interpret(f, [1])
+ assert res == 42
More information about the Pypy-commit
mailing list