[pypy-svn] r37549 - in pypy/dist/pypy/rpython: . test
ac at codespeak.net
ac at codespeak.net
Mon Jan 29 17:30:16 CET 2007
Author: ac
Date: Mon Jan 29 17:30:15 2007
New Revision: 37549
Modified:
pypy/dist/pypy/rpython/rpbc.py
pypy/dist/pypy/rpython/test/test_rpbc.py
Log:
(arre, pedronis) rpbc proper support for this too, the test passes.
Modified: pypy/dist/pypy/rpython/rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/rpbc.py (original)
+++ pypy/dist/pypy/rpython/rpbc.py Mon Jan 29 17:30:15 2007
@@ -439,6 +439,10 @@
frozendesc = self.rtyper.annotator.bookkeeper.getdesc(pbc)
return self.convert_desc(frozendesc)
+ def rtype_getattr(_, hop):
+ if not hop.s_result.is_constant():
+ raise TyperError("getattr on a constant PBC returns a non-constant")
+ return hop.inputconst(hop.r_result, hop.s_result.const)
class AbstractMultipleFrozenPBCRepr(AbstractMultipleUnrelatedFrozenPBCRepr):
"""For a SomePBC of frozen PBCs with a common attribute access set."""
@@ -480,6 +484,9 @@
return result
def rtype_getattr(self, hop):
+ if hop.s_result.is_constant():
+ return hop.inputconst(hop.r_result, hop.s_result.const)
+
attr = hop.args_s[1].const
vpbc, vattr = hop.inputargs(self, Void)
v_res = self.getfield(vpbc, attr, hop.llops)
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 Mon Jan 29 17:30:15 2007
@@ -1515,7 +1515,6 @@
assert res == 11
def test_single_pbc_getattr(self):
- py.test.skip("in-progress")
class C:
def __init__(self, v1, v2):
self.v1 = v1
More information about the Pypy-commit
mailing list