[NumPy-Tickets] [NumPy] #1735: Setting a rank-0 string array with a numpy scalar does not work on 1.6.0.dev

NumPy Trac numpy-tickets@scipy....
Fri Feb 4 10:58:24 CST 2011


#1735: Setting a rank-0 string array with a numpy scalar does not work on
1.6.0.dev
--------------------+-------------------------------------------------------
 Reporter:  faltet  |       Owner:  somebody
     Type:  defect  |      Status:  new     
 Priority:  normal  |   Milestone:  2.0.0   
Component:  Other   |     Version:  1.5.0   
 Keywords:          |  
--------------------+-------------------------------------------------------
 The next script describes the problem.

 {{{
 import numpy as np

 print "numpy version:", np.__version__

 a = np.zeros((), dtype="S10")
 a[()] = "hello1"  # works!
 print a
 a[()] = np.array("hello2")  # fails on 1.6.0.dev
 print a
 }}}

 Running it with 1.5.0:

 {{{
 numpy version: 1.5.0.dev7987
 hello1
 hello2
 }}}

 With 1.6.0.dev:

 {{{
 numpy version: 1.6.0.dev-0e60ecb
 hello1
 Traceback (most recent call last):
   File "/tmp/scalar-string-bug.py", line 8, in <module>
     a[()] = np.array("hello2")
 ValueError: cannot set an array element with a sequence
 }}}

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1735>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list