Commit e922abb
committed
Use np.asarray to ensure output of np.add is array, not scalar
```
Python 3.10.4 (main, Sep 1 2022, 10:54:42) [GCC 11.2.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.5.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import numpy as np
In [2]: a = np.asarray(3, dtype='long')
In [3]: b = np.asarray(2, dtype='long')
In [4]: c = np.add(a, b)
In [5]: type(c)
Out[5]: numpy.int64
```
It appears this behavior existed with prior versions of Python and numpy as well,
but Cython likely became stricter, and no longer allows assigning NumPy scalars
to variables of `cnp.ndarray` type.1 parent 780fde9 commit e922abb
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
426 | 426 | | |
427 | 427 | | |
428 | 428 | | |
429 | | - | |
| 429 | + | |
430 | 430 | | |
431 | 431 | | |
432 | 432 | | |
| |||
5044 | 5044 | | |
5045 | 5045 | | |
5046 | 5046 | | |
5047 | | - | |
| 5047 | + | |
5048 | 5048 | | |
5049 | 5049 | | |
5050 | 5050 | | |
| |||
0 commit comments