diff options
author | Matteo Raso <matteo_luigi_raso@protonmail.com> | 2023-01-18 02:25:00 -0500 |
---|---|---|
committer | Matteo Raso <matteo_luigi_raso@protonmail.com> | 2023-01-18 02:25:00 -0500 |
commit | 88cdaa21aea87ec7d56d1d583500ab2659a5e65e (patch) | |
tree | fef694437f5e163d7a06c56c39719fe811f643c2 /numpy | |
parent | 68d7aadd30cb7a4f6f32e76715b38b644df18602 (diff) | |
download | numpy-88cdaa21aea87ec7d56d1d583500ab2659a5e65e.tar.gz |
BUG: Added __name__ atribute to vectorize class (#23021)
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/lib/function_base.py | 1 | ||||
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 7a69c3c81..27ed79044 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -2273,6 +2273,7 @@ class vectorize: self.pyfunc = pyfunc self.cache = cache self.signature = signature + self.__name__ = pyfunc.__name__ self._ufunc = {} # Caching to improve default performance if doc is None: diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index ecba35f2d..69e4c4848 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -1780,6 +1780,13 @@ class TestVectorize: assert_equal(type(r), subclass) assert_equal(r, m * v) + def test_name(self): + #See gh-23021 + @np.vectorize + def f2(a, b): + return a + b + + assert f2.__name__ == 'f2' class TestLeaks: class A: |