[pypy-svn] r51946 - in pypy/dist/pypy/translator/cli: . src test

antocuni at codespeak.net antocuni at codespeak.net
Fri Feb 29 11:51:47 CET 2008


Author: antocuni
Date: Fri Feb 29 11:51:46 2008
New Revision: 51946

Modified:
   pypy/dist/pypy/translator/cli/dotnet.py
   pypy/dist/pypy/translator/cli/src/pypylib.cs
   pypy/dist/pypy/translator/cli/test/test_dotnet.py
Log:
fix two failing tests



Modified: pypy/dist/pypy/translator/cli/dotnet.py
==============================================================================
--- pypy/dist/pypy/translator/cli/dotnet.py	(original)
+++ pypy/dist/pypy/translator/cli/dotnet.py	Fri Feb 29 11:51:46 2008
@@ -361,13 +361,15 @@
         else:
             return CLR.System.String(x)
     elif isinstance(x, ootype._class):
-        TYPE = x._INSTANCE
-        if isinstance(TYPE, ootype.StaticMethod):
+        if hasattr(x, '_FUNC'):
+            TYPE = x._FUNC
+            assert isinstance(TYPE, ootype.StaticMethod)
             return typeof(TYPE)
-        name = '%s.%s' % (x._INSTANCE._namespace, x._INSTANCE._classname)
-        t = CLR.System.Type.GetType(name)
-        assert t is not None
-        return t
+        else:
+            name = '%s.%s' % (x._INSTANCE._namespace, x._INSTANCE._classname)
+            t = CLR.System.Type.GetType(name)
+            assert t is not None
+            return t
     elif isinstance(x, PythonNet.System.Object):
         return x
     elif x is None:

Modified: pypy/dist/pypy/translator/cli/src/pypylib.cs
==============================================================================
--- pypy/dist/pypy/translator/cli/src/pypylib.cs	(original)
+++ pypy/dist/pypy/translator/cli/src/pypylib.cs	Fri Feb 29 11:51:46 2008
@@ -57,6 +57,10 @@
     public delegate int DelegateType_int__int_27(int a0, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11, int a12, int a13, int a14, int a15, int a16, int a17, int a18, int a19, int a20, int a21, int a22, int a23, int a24, int a25, int a26);
     public delegate int DelegateType_int__int_100(int a0, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11, int a12, int a13, int a14, int a15, int a16, int a17, int a18, int a19, int a20, int a21, int a22, int a23, int a24, int a25, int a26, int a27, int a28, int a29, int a30, int a31, int a32, int a33, int a34, int a35, int a36, int a37, int a38, int a39, int a40, int a41, int a42, int a43, int a44, int a45, int a46, int a47, int a48, int a49, int a50, int a51, int a52, int a53, int a54, int a55, int a56, int a57, int a58, int a59, int a60, int a61, int a62, int a63, int a64, int a65, int a66, int a67, int a68, int a69, int a70, int a71, int a72, int a73, int a74, int a75, int a76, int a77, int a78, int a79, int a80, int a81, int a82, int a83, int a84, int a85, int a86, int a87, int a88, int a89, int a90, int a91, int a92, int a93, int a94, int a95, int a96, int a97, int a98, int a99);
 
+    public class DummyClass {
+        public static object myfield;
+    }
+
 }
 
 namespace pypy.runtime

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 Feb 29 11:51:46 2008
@@ -510,11 +510,11 @@
         assert res == 42
 
     def test_static_fields(self):
-        Constants = CLR.pypy.runtime.Constants
+        DummyClass = CLR.pypy.test.DummyClass
         def fn():
             obj = System.Object()
-            Constants.const1 = obj
-            return Constants.const1 is obj
+            DummyClass.myfield = obj
+            return DummyClass.myfield is obj
         res = self.interpret(fn, [])
         assert res
 



More information about the Pypy-commit mailing list