[pypy-svn] r13462 - in pypy/dist/pypy/rpython: . test
hpk at codespeak.net
hpk at codespeak.net
Thu Jun 16 01:34:30 CEST 2005
Author: hpk
Date: Thu Jun 16 01:34:27 2005
New Revision: 13462
Modified:
pypy/dist/pypy/rpython/interp.py (contents, props changed)
pypy/dist/pypy/rpython/rbool.py (props changed)
pypy/dist/pypy/rpython/rfloat.py (props changed)
pypy/dist/pypy/rpython/test/snippet.py (props changed)
pypy/dist/pypy/rpython/test/test_interp.py (contents, props changed)
pypy/dist/pypy/rpython/test/test_rbool.py (props changed)
pypy/dist/pypy/rpython/test/test_rfloat.py (props changed)
pypy/dist/pypy/rpython/test/test_rint.py (props changed)
Log:
puh, fixeol (also needed some manual tweaking
because we had mixed line-styles and svn refuses
to set line-styles then)
Modified: pypy/dist/pypy/rpython/interp.py
==============================================================================
--- pypy/dist/pypy/rpython/interp.py (original)
+++ pypy/dist/pypy/rpython/interp.py Thu Jun 16 01:34:27 2005
@@ -2,8 +2,8 @@
from pypy.rpython.lltype import _ptr
import py
-class RPythonError(Exception):
- pass
+class RPythonError(Exception):
+ pass
class LLInterpreter(object):
""" low level interpreter working with concrete values. """
@@ -67,14 +67,14 @@
# determine nextblock and/or return value
if len(block.exits) == 0:
- # return block
- if len(block.inputargs) == 2:
- # exception
- etypevar, evaluevar = block.getvariables()
- etype = self.getval(etypevar)
- #rint etype
- evalue = self.getval(evaluevar)
- # watch out, these are _ptr's
+ # return block
+ if len(block.inputargs) == 2:
+ # exception
+ etypevar, evaluevar = block.getvariables()
+ etype = self.getval(etypevar)
+ #rint etype
+ evalue = self.getval(evaluevar)
+ # watch out, these are _ptr's
raise RPythonError(etype, evalue)
resultvar, = block.getvariables()
result = self.getval(resultvar)
@@ -90,9 +90,9 @@
def eval_operation(self, operation):
# self.log.operation("considering", operation)
ophandler = self.getoperationhandler(operation.opname)
- vals = [self.getval(x) for x in operation.args]
- # if these special cases pile up, do something better here
- if operation.opname == 'cast_pointer':
+ vals = [self.getval(x) for x in operation.args]
+ # if these special cases pile up, do something better here
+ if operation.opname == 'cast_pointer':
vals.insert(0, operation.result.concretetype)
retval = ophandler(*vals)
self.setvar(operation.result, retval)
@@ -140,10 +140,10 @@
assert isinstance(array,_ptr)
return array[index]
# the diff between op_getarrayitem and op_getarraysubstruct
- # is the same as between op_getfield and op_getsubstruct
+ # is the same as between op_getfield and op_getsubstruct
- def op_cast_pointer(self, tp, obj):
- # well, actually this is what's now in the globals.
+ def op_cast_pointer(self, tp, obj):
+ # well, actually this is what's now in the globals.
return cast_pointer(tp, obj)
# __________________________________________________________
# primitive operations
Modified: pypy/dist/pypy/rpython/test/test_interp.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_interp.py (original)
+++ pypy/dist/pypy/rpython/test/test_interp.py Thu Jun 16 01:34:27 2005
@@ -37,15 +37,15 @@
assert res == 43
res = interpret(simple_ifs, [1])
assert res == 42
-
-def test_raise():
- res = interpret(raise_exception, [41])
- assert res == 41
- info = raises(RPythonError, interpret, raise_exception, [42])
- # XXX inspect which exception this was.
- # rtyper.getexceptiondata().ll_exception_match()
- # llexitcase not available here
- # maybe I use pyexcclass2exc ???
+
+def test_raise():
+ res = interpret(raise_exception, [41])
+ assert res == 41
+ info = raises(RPythonError, interpret, raise_exception, [42])
+ # XXX inspect which exception this was.
+ # rtyper.getexceptiondata().ll_exception_match()
+ # llexitcase not available here
+ # maybe I use pyexcclass2exc ???
def test_while_simple():
res = interpret(while_simple, [3])
@@ -109,11 +109,11 @@
while i > 0:
sum += i
i -= 1
- return sum
-
-def raise_exception(i):
- if i == 42:
- raise IndexError
+ return sum
+
+def raise_exception(i):
+ if i == 42:
+ raise IndexError
return i
#__________________________________________________________________
More information about the Pypy-commit
mailing list