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

Giuseppe Corbelli giuseppe.corbelli at copanitalia.com
Mon Jun 13 13:43:05 BST 2011


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.

-- 
            Giuseppe Corbelli
WASP Software Engineer, Copan Italia S.p.A
Phone: +390303666104  Fax: +390302659932
E-mail: giuseppe.corbelli at copanitalia.com


More information about the PyQt mailing list