[pypy-svn] r34718 - in pypy/dist/pypy/translator/cli: . test
antocuni at codespeak.net
antocuni at codespeak.net
Fri Nov 17 20:38:05 CET 2006
Author: antocuni
Date: Fri Nov 17 20:38:04 2006
New Revision: 34718
Modified:
pypy/dist/pypy/translator/cli/database.py
pypy/dist/pypy/translator/cli/test/test_dotnet.py
Log:
A failing test and the relative bug fix.
Modified: pypy/dist/pypy/translator/cli/database.py
==============================================================================
--- pypy/dist/pypy/translator/cli/database.py (original)
+++ pypy/dist/pypy/translator/cli/database.py Fri Nov 17 20:38:04 2006
@@ -127,7 +127,11 @@
return name
def class_name(self, INSTANCE):
- return self.classes[INSTANCE]
+ try:
+ NATIVE_INSTANCE = INSTANCE._hints['NATIVE_INSTANCE']
+ return NATIVE_INSTANCE._name
+ except KeyError:
+ return self.classes[INSTANCE]
def get_record_name(self, RECORD):
try:
Modified: pypy/dist/pypy/translator/cli/test/test_dotnet.py
==============================================================================
--- pypy/dist/pypy/translator/cli/test/test_dotnet.py (original)
+++ pypy/dist/pypy/translator/cli/test/test_dotnet.py Fri Nov 17 20:38:04 2006
@@ -249,6 +249,23 @@
res = self.ll_to_string(self.interpret(fn, []))
assert res.startswith("Index is less than 0")
+ def test_native_exception_invoke(self):
+ TargetInvocationException = NativeException(CLR.System.Reflection.TargetInvocationException)
+ def fn():
+ x = ArrayList()
+ t = x.GetType()
+ meth = t.GetMethod('get_Item')
+ args = init_array(System.Object, box(0))
+ try:
+ meth.Invoke(x, args)
+ return "Impossible!"
+ except TargetInvocationException, e:
+ inner = native_exc(e).get_InnerException()
+ message = str(inner.get_Message())
+ return message
+ res = self.ll_to_string(self.interpret(fn, []))
+ assert res.startswith("Index is less than 0")
+
class TestPythonnet(TestDotnetRtyping):
# don't interpreter functions but execute them directly through pythonnet
def interpret(self, f, args):
More information about the Pypy-commit
mailing list