Hi,

Robert Bradshaw wrote:
> On May 30, 2008, at 4:24 AM, Stefan Behnel wrote:
>> Also, code like
>>
>>                 code.putln('"%s",' % name)
>>
>> may not work in all cases. If we can't be sure it's a pure ASCII  
>> identifier
>> (i.e. it was parsed as an identifier by the current Cython parser),  
>> the name
>> has to be encoded as UTF-8 first and escaped using  
>> Utils.escape_byte_string().
> 
> On this note, what happens when a cdef variable (like above) has non- 
> ASCII characters in it?

Not sure what you mean here.

Do you mean in its name? That can't currently happen as the scanner only
allows pure ASCII alphanumeric identifiers. I don't think we should support
PEP 3131 in Cython, the mapping to C identifiers would become too obscure.

http://www.python.org/dev/peps/pep-3131/

Keyword arguments are a different thing, but allowing non-ASCII keywords in
function signatures will require us to write our own ParseTupleAndKeywords()
to keep up compatibility with Py2, so I don't find that worth supporting
either (for now). Although having our own PTAK() where you could simply pass
Python strings as acceptable keyword list would be helpful in general...

In case you were asking about string values: any non-ASCII or \0 characters in
the encoded byte string are backslash escaped in the C source so that the C
compiler creates the correct byte sequence in any case, which is then passed
to the respective Python API functions at runtime to decode it into a Python
string.

If you meant something else, feel free to clarify. :)

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

Reply via email to