[pypy-svn] r35120 - pypy/dist/pypy/module/_dotnet

antocuni at codespeak.net antocuni at codespeak.net
Wed Nov 29 15:24:29 CET 2006


Author: antocuni
Date: Wed Nov 29 15:24:28 2006
New Revision: 35120

Modified:
   pypy/dist/pypy/module/_dotnet/interp_dotnet.py
Log:
Raise a nice exception instead of crashing when encountering a unknown
type.



Modified: pypy/dist/pypy/module/_dotnet/interp_dotnet.py
==============================================================================
--- pypy/dist/pypy/module/_dotnet/interp_dotnet.py	(original)
+++ pypy/dist/pypy/module/_dotnet/interp_dotnet.py	Wed Nov 29 15:24:28 2006
@@ -42,7 +42,9 @@
         if space.is_true(space.isinstance(w_obj, self.space.w_int)):
             return box(space.int_w(w_obj))
         else:
-            assert False
+            typename = space.type(w_obj).getname(space, '?')
+            msg = "Can't convert type %s to .NET" % typename
+            raise OperationError(self.space.w_TypeError, self.space.wrap(msg))
 
     def cli2py(self, b_obj):
         intval = unbox(b_obj, ootype.Signed) # TODO: support other types



More information about the Pypy-commit mailing list