Commits

Brian Kearns  committed 91105b7

add ufunc.__name__ property

  • Participants
  • Parent commits 1fa0a9d

Comments (0)

Files changed (2)

File pypy/module/micronumpy/interp_ufuncs.py

         self.allow_complex = allow_complex
         self.complex_to_float = complex_to_float
 
+    def descr_get_name(self, space):
+        return space.wrap(self.name)
+
     def descr_repr(self, space):
         return space.wrap("<ufunc '%s'>" % self.name)
 
 
     __call__ = interp2app(W_Ufunc.descr_call),
     __repr__ = interp2app(W_Ufunc.descr_repr),
+    __name__ = GetSetProperty(W_Ufunc.descr_get_name),
 
     identity = GetSetProperty(W_Ufunc.descr_get_identity),
     accumulate = interp2app(W_Ufunc.descr_accumulate),

File pypy/module/micronumpy/test/test_ufuncs.py

         assert isinstance(add, ufunc)
         assert repr(add) == "<ufunc 'add'>"
         assert repr(ufunc) == "<type 'numpy.ufunc'>"
+        assert add.__name__ == 'add'
 
     def test_ufunc_attrs(self):
         from numpypy import add, multiply, sin