Lisandro Dalcin, 26.08.2010 15:21:
> On 26 August 2010 00:34, Stefan Behnel wrote:
>> Lisandro Dalcin, 25.08.2010 22:50:
>>> This is from my own code (mpi4py):
>>>
>>> from array import array as arraytype
>>> ary = arraytype('i', [0])
>>>
>>> Thanks to the special handling of string literals under -2, this code
>>> works (at runtime) in both Python 2 and Python 3...
>>>
>>> Howerver, when using cython -3, I get a failure under Python 2:
>>>
>>> TypeError: array() argument 1 must be char, not unicode
>>
>> That's a NumPy bug. Unicode strings should be valid string input also in
>> Python 2.
>
> No, it is not NumPy... it is the core Python stdlib array module in
> all 2.x versions.

Argh, I keep misreading imports, sorry ...

Ok, it's a bug in the Py2 array module then. Looks like it hasn't even been 
fixed in 2.7.

This is a difference between the runtime environments that you have to work 
around it in your own code. Seriously, if you want Python 3 semantics for 
your source code, you get Python 3 semantics for your source code. This has 
nothing to do with the array module. Cython simply cannot know that the 
array module fails to accept unicode input and requires bytes input 
instead. Imagine you did the same thing with a third party module that has 
the same bug. Would you want Cython to adapt to that, too?

Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to