Stefan Behnel, 04.09.2010 21:30:
> Stefan Behnel, 25.08.2010 22:09:
>> Lisandro Dalcin, 25.08.2010 21:57:
>>> On 25 August 2010 16:16, Stefan Behnel wrote:
>>>> Lisandro Dalcin, 25.08.2010 21:00:
>>>>> $ cython -3 tmp.pyx
>>>>>
>>>>> Error converting Pyrex file to C:
>>>>> ------------------------------------------------------------
>>>>> ...
>>>>> cdef str a = "abc"
>>>>>                 ^
>>>>> ------------------------------------------------------------
>>>>>
>>>>> /u/dalcinl/tmp/tmp.pyx:1:13: Cannot convert Unicode string to 'str'
>>>>> implicitly. This is not portable and requires explicit encoding.
>>>>
>>>> Same thing I said before: if you request unicode string literals, you get
>>>> unicode literals.
>>>
>>> But in Python 3, the the Python-level 'str' type actually  is an unicode 
>>> string!
>>
>> Ah, right, I missed that. Yes, I think it makes sense to statically
>> associate 'str' with 'unicode' on -3.
>
> Hmm, that's tricky, though. We can't change the Builtin scope itself as
> that's a global thing, so we somehow need to intercept lookups of 'str'
> before hitting the builtin scope and replace it by 'unicode', so that both
> the 'cdef str' declaration work as well as Python references to the builtin
> type. Ugly...

http://trac.cython.org/cython_trac/ticket/576

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

Reply via email to