[Numpy-tickets] [NumPy] #525: Inconsistency in the length of buffers of unicode scalars

NumPy numpy-tickets@scipy....
Tue May 22 17:07:41 CDT 2007


#525: Inconsistency in the length of buffers of unicode scalars
------------------------+---------------------------------------------------
 Reporter:  faltet      |        Owner:  somebody     
     Type:  defect      |       Status:  closed       
 Priority:  normal      |    Milestone:  1.0.3 Release
Component:  numpy.core  |      Version:  devel        
 Severity:  normal      |   Resolution:  wontfix      
 Keywords:              |  
------------------------+---------------------------------------------------
Changes (by oliphant):

  * status:  new => closed
  * resolution:  => wontfix

Comment:

 I'm afraid this is an unavoidable "in-consistency" without some serious
 changes and introducing other "inconsistencies."   The numpy.unicode_ type
 inherits from the standard Python unicode type.  To do this, it must have
 the same C-layout (i.e. using the PyUnicodeObject structure with it's
 2-byte unicode characters on narrow builds).  Thus, while the array
 unicode data-type is always a 4-byte unicode character, the array scalar
 unicode_ Python type is represented by 2-byte unicode characters.

 The only problem, I can see in this case is that u.data for the scalar is
 reporting itself to be of size 16 in it's repr output.

 So, it is invalid to use a numpy.unicode_ scalar as an int32 data-type on
 narrow Python builds.  The numpy.unicode_ array scalar type follows the
 size of the Python unicode type.

-- 
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/525#comment:1>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list