[pypy-svn] r28447 - in pypy/dist/pypy/translator/cli: . test
antocuni at codespeak.net
antocuni at codespeak.net
Wed Jun 7 15:08:24 CEST 2006
Author: antocuni
Date: Wed Jun 7 15:08:23 2006
New Revision: 28447
Modified:
pypy/dist/pypy/translator/cli/conftest.py
pypy/dist/pypy/translator/cli/test/runtest.py
Log:
Added an option to let .NET exception flowing out of the entry point.
Modified: pypy/dist/pypy/translator/cli/conftest.py
==============================================================================
--- pypy/dist/pypy/translator/cli/conftest.py (original)
+++ pypy/dist/pypy/translator/cli/conftest.py Wed Jun 7 15:08:23 2006
@@ -15,6 +15,9 @@
help="print the generated IL code to stdout, too"),
Option('--nostop', action="store_true", dest="nostop", default=False,
- help="don't stop on warning. The generated IL code could not compile")
+ help="don't stop on warning. The generated IL code could not compile"),
+
+ Option('--nowrap', action="store_true", dest="nowrap", default=False,
+ help="don't wrap exceptions but let them to flow out of the entry point")
)
Modified: pypy/dist/pypy/translator/cli/test/runtest.py
==============================================================================
--- pypy/dist/pypy/translator/cli/test/runtest.py (original)
+++ pypy/dist/pypy/translator/cli/test/runtest.py Wed Jun 7 15:08:23 2006
@@ -79,9 +79,12 @@
for exc in ('[mscorlib]System.Exception', 'exceptions.Exception'):
ilasm.begin_catch(exc)
- ilasm.call('string class [pypylib]pypy.test.Result::FormatException(object)')
- ilasm.call('void class [mscorlib]System.Console::WriteLine(string)')
- ilasm.leave('return')
+ if getoption('nowrap'):
+ ilasm.opcode('throw')
+ else:
+ ilasm.call('string class [pypylib]pypy.test.Result::FormatException(object)')
+ ilasm.call('void class [mscorlib]System.Console::WriteLine(string)')
+ ilasm.leave('return')
ilasm.end_catch()
# write the result to stdout
@@ -210,12 +213,17 @@
def __init__(self, class_name):
self.class_name = class_name
+ def __repr__(self):
+ return 'ExceptionWrapper(%s)' % repr(self.class_name)
class CliTest(BaseRtypingTest, OORtypeMixin):
def interpret(self, fn, args):
ann = [lltype_to_annotation(typeOf(x)) for x in args]
f = compile_function(fn, ann)
- return f(*args)
+ res = f(*args)
+ if isinstance(res, ExceptionWrapper):
+ raise ExceptionWrapper
+ return res
def interpret_raises(self, exception, fn, args):
import exceptions # needed by eval
More information about the Pypy-commit
mailing list