[pypy-svn] r56693 - in pypy/branch/oo-jit/pypy/translator/cli: . test

antocuni at codespeak.net antocuni at codespeak.net
Sun Jul 20 19:00:09 CEST 2008


Author: antocuni
Date: Sun Jul 20 19:00:08 2008
New Revision: 56693

Modified:
   pypy/branch/oo-jit/pypy/translator/cli/dotnet.py
   pypy/branch/oo-jit/pypy/translator/cli/test/test_dotnet.py
Log:
use the proper attribute of _INSTANCE to get the fully qualified name,
else box() will fail with instances of classes defined in external
assemblies



Modified: pypy/branch/oo-jit/pypy/translator/cli/dotnet.py
==============================================================================
--- pypy/branch/oo-jit/pypy/translator/cli/dotnet.py	(original)
+++ pypy/branch/oo-jit/pypy/translator/cli/dotnet.py	Sun Jul 20 19:00:08 2008
@@ -366,7 +366,7 @@
             assert isinstance(TYPE, ootype.StaticMethod)
             return typeof(TYPE)
         else:
-            name = '%s.%s' % (x._INSTANCE._namespace, x._INSTANCE._classname)
+            name = x._INSTANCE._assembly_qualified_name
             t = CLR.System.Type.GetType(name)
             assert t is not None
             return t

Modified: pypy/branch/oo-jit/pypy/translator/cli/test/test_dotnet.py
==============================================================================
--- pypy/branch/oo-jit/pypy/translator/cli/test/test_dotnet.py	(original)
+++ pypy/branch/oo-jit/pypy/translator/cli/test/test_dotnet.py	Sun Jul 20 19:00:08 2008
@@ -585,6 +585,14 @@
             return int32_type.get_Name()
         assert self.interpret(fn, []) == 'Int32'
 
+    def test_classof_external_assembly(self):
+        utils_class = classof(Utils)
+        def fn():
+            utils_obj = box(utils_class)
+            utils_type = clidowncast(utils_obj, System.Type)
+            return utils_type.get_Name()
+        assert self.interpret(fn, []) == 'Utils'
+
     def test_classof_compare(self):
         int32_a = classof(System.Int32)
         int32_b = classof(System.Int32)



More information about the Pypy-commit mailing list