Am 06.09.2010 23:12, schrieb Stefan Behnel:
> Kay Hayen, 06.09.2010 23:04:
>> Am 06.09.2010 22:07, schrieb Stefan Behnel:
>>> That's not the problem we are discussing here, though. This thread is about
>>> *C string*  literals, which should or should not change due to
>>> unicode_literals being enabled. That's the question.
>>>
>>> I think it makes sense to keep the two discussions separate.
>>
>> Wasn't this why wchar_t was invented?
>
> Now we're really drifting off-topic. ;)
>
> No, that's totally unrelated. The "wchar_t" type is used internally for
> Unicode strings (typedef-ed to "Py_UNICODE") by CPython on Windows. It has
> nothing to do with the char* type used to represent C (byte!) strings, and
> in particular, it has nothing to do with the *content* of C byte strings
> and its mapping from C byte string literals in Cython code, which is what
> this discussion is about.

Well, if the discussion is about solving Lisandro's goals, then it is 
about how Python literals can be matched with a C type.

And when a Python literal has a variant type depending on Parser flags, 
then C code could just as well have them too.

That's why I recalled wchar_t, which historically has been used that 
way, but it could be any other type too, that is a "char" when no 
unicode_literals, and is a "Py_UNICODE" when they are active.

If I understand Lisandro right, his goal is to write portable code. And 
portable code would best be served by having a C type equivalent of the 
Python type. Name it however you want, but I think it is needed to write 
code that doesn't convert the strings at all.

That other topic, of C string literals seems like solving a problem that 
shouldn't exist. Why should the Python code use unicode literals and the 
C code not, that is just incompatible to Python. You know where I stand 
on that issue. Just don't use/allow "char *" as an interface with Python 
strings (as opposed to bytes) if you want to be Python 3 compatible.

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

Reply via email to