[pypy-commit] pypy refactor-signature: fix forced signature

fijal noreply at buildbot.pypy.org
Wed Dec 7 12:13:44 CET 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: refactor-signature
Changeset: r50241:00c7a228329b
Date: 2011-12-07 13:13 +0200
http://bitbucket.org/pypy/pypy/changeset/00c7a228329b/

Log:	fix forced signature

diff --git a/pypy/module/micronumpy/interp_dtype.py b/pypy/module/micronumpy/interp_dtype.py
--- a/pypy/module/micronumpy/interp_dtype.py
+++ b/pypy/module/micronumpy/interp_dtype.py
@@ -30,6 +30,7 @@
         self.alternate_constructors = alternate_constructors
         self.array_signature = signature.ArraySignature()
         self.scalar_signature = signature.ScalarSignature()
+        self.forced_signature = signature.ForcedSignature()
         #self.flatiter_signature = signature.FlatiterSignature()
         #self.view_signature = signature.ViewSignature()
 
diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -998,6 +998,7 @@
     def force_if_needed(self):
         if self.forced_result is None:
             self.forced_result = self.compute()
+            self.signature = self.find_dtype().forced_signature
             self._del_sources()
 
     def get_concrete(self):
diff --git a/pypy/module/micronumpy/signature.py b/pypy/module/micronumpy/signature.py
--- a/pypy/module/micronumpy/signature.py
+++ b/pypy/module/micronumpy/signature.py
@@ -106,7 +106,8 @@
                                       self.right.debug_repr())
 
 class ForcedSignature(Signature):
-    pass
+    def debug_repr(self):
+        return 'Forced'
 
 class ReduceSignature(Call2):
     pass
diff --git a/pypy/module/micronumpy/test/test_numarray.py b/pypy/module/micronumpy/test/test_numarray.py
--- a/pypy/module/micronumpy/test/test_numarray.py
+++ b/pypy/module/micronumpy/test/test_numarray.py
@@ -878,8 +878,7 @@
         assert sin(a).__debug_repr__() == 'Call1(sin, Array)'
         b = a + a
         b[0] = 3
-        skip("not there")
-        assert b.__debug_repr__() == 'Call2(add, forced=Array)'
+        assert b.__debug_repr__() == 'Forced'
 
 class AppTestMultiDim(BaseNumpyAppTest):
     def test_init(self):


More information about the pypy-commit mailing list