TypeError: astype() got an unexpected keyword argument 'casting'

Issue #29 invalid
Kevin Keraudren created an issue

Analysis:

cd ~/.local/lib/pypy2.7/site-packages/numpy
grep -r "def astype" *
lib/user_array.py:    def astype(self, typecode):
ma/core.py:    def astype(self, newtype):

Conclusion: edit line 14 of
.local/lib/pypy2.7/site-packages/numpy/core/multiarray.py

to change:
src = src.astype(dst.dtype, casting=casting)
into:
src = src.astype(dst.dtype)

Comments (4)

  1. mattip

    the casting keyword is supported on PyPy 2.6.0, if you choose to use an earlier PyPy you must use a version of this repo before commit 0208abe, which is marked for PyPy 2.6.0

  2. Kevin Keraudren reporter

    Then shouldn't lib/user_array.py and ma/core.py also support the casting keyword? Or did I run the grep mentioned above in a wrong branch when I installed numpy through git clone https://bitbucket.org/pypy/numpy.git ?

  3. mattip

    We branched off of upstream numpy. As far as I can tell, upstream numpy does not support the casting keyword in astype() in the files you noted, so pypy's numpy simply copies that behaviour

  4. Log in to comment