[NumPy-Tickets] [NumPy] #2081: String gets truncated in asarray() in Python 3.2

NumPy Trac numpy-tickets@scipy....
Wed Mar 14 13:41:09 CDT 2012


#2081: String gets truncated in asarray() in Python 3.2
-----------------------+----------------------------------------------------
 Reporter:  taldcroft  |       Owner:  somebody   
     Type:  defect     |      Status:  new        
 Priority:  normal     |   Milestone:  Unscheduled
Component:  Other      |     Version:  devel      
 Keywords:             |  
-----------------------+----------------------------------------------------
 Using numpy devel with Python 3.2 gives an unexpected result trying to
 initialize an array from numpy string objects.  This is a regression from
 previous behavior (devel prior to about two weeks ago and 1.6.1).

 devel:

 {{{
 >>> d = np.array(['a'])
 >>> np.asarray([d[0]])
 array([''],
       dtype='<U0')
 }}}

 In numpy 1.6.1:

 {{{
 >>> d = np.array(['a'])
 >>> np.asarray([d[0]])
 array(['a'],
       dtype='<U1')
 }}}

 If one uses a longer string like "abcd" instead of "a" then the result is
 "ab", so it looks like the actual output length is // 2 from the desired
 length.  Perhaps this is related to:

 https://github.com/numpy/numpy/commit/91f87e1f613630ff0ad9864017f059afcd6e57f1

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


More information about the NumPy-Tickets mailing list