[pypy-svn] r37679 - pypy/dist/pypy/translator/cli

antocuni at codespeak.net antocuni at codespeak.net
Wed Jan 31 17:33:02 CET 2007


Author: antocuni
Date: Wed Jan 31 17:33:01 2007
New Revision: 37679

Modified:
   pypy/dist/pypy/translator/cli/dotnet.py
Log:
aargh! We need to unwrap the object *before* the typecheck!



Modified: pypy/dist/pypy/translator/cli/dotnet.py
==============================================================================
--- pypy/dist/pypy/translator/cli/dotnet.py	(original)
+++ pypy/dist/pypy/translator/cli/dotnet.py	Wed Jan 31 17:33:01 2007
@@ -338,6 +338,9 @@
         return res
 
 def unbox(x, TYPE):
+    if isinstance(x, PythonNet.pypy.test.ObjectWrapper):
+        x = BoxedSpace.get(x.index)
+
     if isinstance(TYPE, (type, types.ClassType)):
         # we need to check the TYPE and return None if it fails
         if isinstance(x, TYPE):
@@ -347,9 +350,6 @@
 
     # TODO: do the typechecking also in the other cases
 
-    if isinstance(x, PythonNet.pypy.test.ObjectWrapper):
-        return BoxedSpace.get(x.index)
-
     # this is a workaround against a pythonnet limitation: you can't
     # directly get the, e.g., python int from the System.Int32 object:
     # a simple way to do this is to put it into an ArrayList and



More information about the Pypy-commit mailing list