No description provided.
Fix for issue #385.
This pull request passes (merged 2f28574 into 63cd8f3).
@jwoillez, thanks for the patch. Can you please add a test for this issue as well? That fails before your patch and works after your patch is applied.
Formatting test for scalar of type void.
@certik, hopefully, this is the right location for such a test.
Should tests for np.str_ and np.unicode_ also be added?
This pull request fails (merged be46fc7 into 63cd8f3).
Passes on python 2, fails on python 3. Unfortunately, I don't have access to numpy on python 3 yet.
Just install python 3.2 from python.org, numpy can then be installed using "python3 setup.py install", and it will just work.
Use a bytes object instead of a string, for python3.
This pull request fails (merged 30a899b into 63cd8f3).
And now it fails for python2.5 (2.6 and 2.7 are OK) because bytes objects don't exist there. And for python3 because the formatting gives different results.
I will have to give all this some more thoughts. Maybe my fix is not the best fix.
Going to ping the travis bot. support for 2.5 & 2.4 dropped, so that should help.
The problem is that void arrays print differently in python3, as a list of byte values rather than an ascii string. This needs a decision and fix for the str function of void arrays. I think the list might be prettier, but perhaps folks expect void to be treated as an ascii string, which is what python2 does.
I'm tending towards byte strings, especially for repr since passing lists for array creation with dtype=void doesn't work correctly.
Related to this printing issue, I also noticed that, with python3 & latest numpy, we get the following:
Python 3.3.0 (default, Nov 23 2012, 10:26:01)
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
[97 98 99]
'array([97, 98, 99], dtype=int8)'
numpy.array2string does not seem to interpret this numpy.void properly.
What should the expected behavior be?
I think it should be a byte string.
This appears fixed by #4401, so closing. The test failure would remain. Thinking about it, I'm no longer convinced that printing a byte string is preferable to the python3 version...