[PyQt] Pylupdate4 does not parse tr(u"") ?

Phil Thompson phil at riverbankcomputing.com
Fri Jun 24 11:56:40 BST 2011


On Mon, 13 Jun 2011 14:43:05 +0200, Giuseppe Corbelli
<giuseppe.corbelli at copanitalia.com> wrote:
> On 10/06/2011 10:52, Giuseppe Corbelli wrote:
>> So it seems that pylupdate4 does NOT parse tr(u"") stuff. Is it by
>> design?
>> Sorry but I can't dive into it at present.
> 
> Seems that I was right, rare stuff indeed.
> 
> Look into pylupdate/fetchtr.cpp, around line 380
> You will see a
> 
> case '(':
>     if (yyParenDepth == 0)
>       yyParenLineNo = yyCurLineNo;
>     yyParenDepth++;
>     yyCh = getChar();
>     return Tok_LeftParen;
> 
> 
> Replace with:
> 
> case '(':
>     if (yyParenDepth == 0)
>         yyParenLineNo = yyCurLineNo;
>     yyParenDepth++;
>     yyCh = getChar();
>     //It may be a tr(u"whatever"), skip the 'u'
>     if (yyCh == 'u')
>         yyCh = getChar();
>     return Tok_LeftParen;
> 
> It seems to work (just eats one more char). If you find it useful please
> apply
> into the main line.

This is fixed (differently) in tonight's snapshot.

Thanks,
Phil


More information about the PyQt mailing list