Hi There, On 02/07/13 16:00, Dongsheng Song wrote: > Today, when I merge zh_CN.po from trunk to 1.8.x, I had encounter the > following error: > > $ python ../../../../trunk/tools/dev/po-merge.py < > ../../../../trunk/subversion/po/zh_CN.po zh_CN.po > 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 > > Then I found in the line 39-40 of po-merge.py return None as msgstr: > > if line.strip() == '' or line[:2] == '#~': > return comments, None, None, None > > So we should not do iteration on msgstr without make sure msgstr is > not None. > > This happened because zh_CN.po have msgmerged po comments like this: > > #~ msgid "Uncommitted local addition, copy or move%s" > #~ msgstr "未提交的本地增加,复制或移动 %s" > > As your judgement, this is not "obvious fix", should I revert this > commit ?
I cannot make sense of this change other than when malformed input files are concerned. Your example "^#~" requires msgstr == None == msgid as per the return of parse_translation(). That, then, means that comments evaluates to true (has entries) for the break in line 153 not to trigger. Can you give to input files (URl/revisions) that trigger this? So far this is my best guess: #SOMETHING #~ msgid "some msgid" #~ msgstr "some msgstr" I agree that msgstr == None should not be iterated, however I don't see how we get to this case. Andreas