[pypy-issue] [issue1598] Multiplication of np.ndarray with a Python int or float results in loss of dtype

benma tracker at bugs.pypy.org
Wed Sep 11 18:19:21 CEST 2013


New submission from benma <mbencun at gmail.com>:

Hi

a = np.array([1,2,3], dtype=np.int16)
# outputs dtype('int64') instead of dtype('int16')
print (a*2).dtype 

Same thing happens with floats. dtype is resetted to the default dtype, 64 bits
on my machine. numpy on CPython keeps the original dtype. 

I ran into this bug when I used (a*2) as an input to a C function and the size
(in bytes) of each element doubled.

Best, Marko

----------
messages: 6143
nosy: benma, pypy-issue
priority: bug
release: 2.1
status: unread
title: Multiplication of np.ndarray with a Python int or float results in loss of dtype

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1598>
________________________________________


More information about the pypy-issue mailing list