[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1498947 - /subversion/trunk/tools/dev/po-merge.py

From: Daniel Shahaf <danielsh_at_elego.de>
Date: Tue, 2 Jul 2013 17:30:57 +0300

dongsheng_at_apache.org wrote on Tue, Jul 02, 2013 at 14:12:44 -0000:
> Author: dongsheng
> Date: Tue Jul 2 14:12:44 2013
> New Revision: 1498947
>
> URL: http://svn.apache.org/r1498947
> Log:
> Make sure msgstr is not None before do iteration.
>
> Obvious fix.
>

No, it's not an obvious fix. It's a code change, and one which is not
obvious, so it requires review.

> Since parse_translation maybe return (comments, None, None, None),

When does that happen? Why is that not a bug? Why no translator run
into it until today?

Thanks,

Daniel

> * tools/dev/po-merge.py
> we should not do iteration without check msgstr is not None. Otherwise,
> we may encounter the following TypeError:
>
> Traceback (most recent call last):
> File "../../../../trunk/tools/dev/po-merge.py", line 196, in <module>
> main(sys.argv)
> File "../../../../trunk/tools/dev/po-merge.py", line 181, in main
> for m in msgstr:
> TypeError: 'NoneType' object is not iterable
>
> Modified:
> subversion/trunk/tools/dev/po-merge.py
>
> Modified: subversion/trunk/tools/dev/po-merge.py
> URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dev/po-merge.py?rev=1498947&r1=1498946&r2=1498947&view=diff
> ==============================================================================
> --- subversion/trunk/tools/dev/po-merge.py (original)
> +++ subversion/trunk/tools/dev/po-merge.py Tue Jul 2 14:12:44 2013
> @@ -178,9 +178,10 @@ def main(argv):
> for i in msgstr:
> outfile.write('msgstr[%s] %s\n' % (n, msgstr[n]))
> n += 1
> - for m in msgstr:
> - if m == '""':
> - untranslated += 1
> + if msgstr is not None:
> + for m in msgstr:
> + if m == '""':
> + untranslated += 1
> for c in comments:
> if c.startswith('#,') and 'fuzzy' in c.split(', '):
> fuzzy += 1
>
>
Received on 2013-07-02 16:31:36 CEST

This is an archived mail posted to the Subversion Dev mailing list.