В обновлении 1.17 numpy
In [216]: np.linspace(0,1,10.)
Out[216]:
array([0. , 0.11111111, 0.22222222, 0.33333333, 0.44444444,
0.55555556, 0.66666667, 0.77777778, 0.88888889, 1. ])
до 1.18
In [2]: np.linspace(0,10,10.)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/numpy/core/function_base.py in linspace(start, stop, num, endpoint, retstep, dtype, axis)
116 try:
--> 117 num = operator.index(num)
118 except TypeError:
TypeError: 'float' object cannot be interpreted as an integer
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
<ipython-input-2-1e9a5a5e4a05> in <module>
----> 1 np.linspace(0,10,10.)
<__array_function__ internals> in linspace(*args, **kwargs)
/usr/local/lib/python3.6/dist-packages/numpy/core/function_base.py in linspace(start, stop, num, endpoint, retstep, dtype, axis)
119 raise TypeError(
120 "object of type {} cannot be safely interpreted as an integer."
--> 121 .format(type(num)))
122
123 if num < 0:
TypeError: object of type <class 'float'> cannot be safely interpreted as an integer.
То, что тест num = operator.index(num)
имел функцию предупреждения deprecation
, num = _index_deprecate(num)
, теперь возникает ошибка.
https://github.com/numpy/numpy/blob/v1.17.0/numpy/core/function_base.py#L37 -L179