On Apr 22, 2008, at 1:13 PM, Stefan Behnel wrote:

> Hi,
>
> Stefan Behnel wrote:
>> just a quick note that I started working on PEP 263 (source code  
>> encoding
>> declaration) and PEP 3120 (UTF-8 as default source encoding).
>
> Ok, I have it working, including correct doc-string types.
>
> The idea is that strings remember their encoding themselves. Every  
> string that
> ends up in a StringNode is an EncodedString, which is a subclass of  
> unicode
> with an additional "encoding" attribute. It's None for unicode  
> strings and the
> source encoding name for byte strings. Strings are then byte re- 
> encoded on the
> way into a Symtab.Entry, and serialised into the C file as  
> expected. This also
> nicely handles .pxi includes with different source encodings.
>
> However, once I got that finished, I noticed that there is a bug in  
> the
> control flow tracker. It keeps an empty tuple as initial end  
> position and
> seems to rely on the fact that in Py2 the empty tuple () sorts  
> before ('some
> string',). However, (u'some string') sorts *after* (). This is  
> obviously a
> completely arbitrary order, and no code should really rely on  
> something like
> that. For exactly that reason, Py3 will not allow this anymore and  
> (IIRC)
> raises an exception instead.
>
> Robert, before I dig into this, you know this part of the code much  
> better
> than I do. Could you try fixing this up?

The whole control flow thing needs some more serious thought, and  
that I put it all on hold hoping that Fabrizio would get his project  
accepted and do it a much cleaner way. Right now it's just used to  
determine if arguments are assigned to in the body (which could be  
done otherwise).

Choosing a unicode string that's before and after everything seems  
just as arbitrary, but the whole setup needs to be changed.

- Robert

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

Reply via email to