On May 31, 2008, at 10:29 AM, Stefan Behnel wrote:

> 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.

Yep, that's what I meant (and, in fact, that's what the code above is  
using).

> 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/

Anything we don't support is a bug.

> 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...

We wouldn't have to back-port this to Py2, it would be an error in  
this case (maybe at C compile time there would an error raised if non- 
ascii identifiers are used).

- Robert

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

Reply via email to