-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Closed
Description
Follows on from #1123
I'm assigning a numpy.unicode_ to a slice of array of numpy.unicode_ and see the following:
In [85]: l = np.array([u'blah',u'blah',u'blah'])
In [87]: type(l[0])
Out[87]: numpy.unicode_
In [88]: v = np.unicode_('bubu')
In [89]: l[0] = v
In [90]: l
Out[90]:
array([u'bubu', u'blah', u'blah'],
dtype='<U4')
In [91]: l[1:3] = v
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
In [92]: l
Out[92]:
array([u'bubu', u'\uf500\udc62\uf500\udc62\u8d00\udc00',
u'\uf500\udc62\uf500\udc62\u8d00\udc00'],
dtype='<U4')
<<<<<<<<<<<< I consider this a problem
In [93]: {k: v for k, v in sysconfig.get_config_vars().items() if 'unicode' in k.lower()}
Out[93]:
{'PY_UNICODE_TYPE': 'unsigned short',
'Py_UNICODE_SIZE': 2,
'Py_USING_UNICODE': 1,
'UNICODE_OBJS': 'Objects/unicodeobject.o Objects/unicodectype.o'}
In [94]: np.**version**
Out[94]: '1.7.1'$ uname -a
Linux ... 2.6.32-279.19.1.el6.x86_64 #1 SMP Wed Dec 19 07:05:20 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
On a wide unicode build I can do the same with no problem:
In [81]: l = np.array([u'blah',u'blah',u'blah'])
In [82]: type(l[0])
Out[82]: numpy.unicode_
In [83]: v = np.unicode_('bubu')
In [84]: l[0] = v
In [85]: l
Out[85]:
array([u'bubu', u'blah', u'blah'],
dtype='<U4')
In [86]: l[1:3] = v
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
In [87]: l
Out[87]:
array([u'bubu', u'bubu', u'bubu'],
dtype='<U4')
<<<<<<<<<<<<<<<<<<<<<<<<<<<< this works fine
In [88]: {k: v for k, v in sysconfig.get_config_vars().items() if 'unicode' in k.lower()}
Out[88]:
{'PY_UNICODE_TYPE': 0,
'Py_UNICODE_SIZE': 4,
'Py_USING_UNICODE': 1,
'UNICODE_OBJS': 'Objects/unicodeobject.o Objects/unicodectype.o'}
In [89]: np.**version**
Out[89]: '1.7.1'(my27py)pavel@pavel-ThinkPad-T520:~$ uname -a
Linux pavel-ThinkPad-T520 3.2.0-40-generic #64-Ubuntu SMP Mon Mar 25 21:22:10 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Reactions are currently unavailable