[Numpy-discussion] Status of NumPy and Python 3.3

Ondřej Čertík ondrej.certik at gmail.com
Sat Jul 28 18:04:29 EDT 2012


Many of the failures in
https://gist.github.com/3194707/5696c8d3091b16ba8a9f00a921d512ed02e94d71
are of the type:

======================================================================
FAIL: Check byteorder of single-dimensional objects
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ondrej/py33/lib/python3.3/site-packages/numpy/core/tests/test_unicode.py",
line 286, in test_valuesSD
    self.assertTrue(ua[0] != ua2[0])
AssertionError: False is not true


and those are caused by the following minimal example:

Python 3.2:

>>> from numpy import array
>>> a = array(["abc"])
>>> b = a.newbyteorder()
>>> a.dtype
dtype('<U3')
>>> b.dtype
dtype('>U3')
>>> a[0].dtype
dtype('<U3')
>>> b[0].dtype
dtype('<U6')
>>> a[0] == b[0]
False
>>> a[0]
'abc'
>>> b[0]
'ៀ\udc00埀\udc00韀\udc00'


Python 3.3:


>>> from numpy import array
>>> a = array(["abc"])
>>> b = a.newbyteorder()
>>> a.dtype
dtype('<U3')
>>> b.dtype
dtype('>U3')
>>> a[0].dtype
dtype('<U3')
>>> b[0].dtype
dtype('<U3')
>>> a[0] == b[0]
True
>>> a[0]
'abc'
>>> b[0]
'abc'


So somehow the newbyteorder() method doesn't change the dtype of the
elements in our new code.
This method is implemented in numpy/core/src/multiarray/descriptor.c
(I think), but so far I don't see
where the problem could be.

Any ideas?

Ondrej



More information about the NumPy-Discussion mailing list