From: Liangent Date: Wed, 30 Sep 2015 15:25:32 +0000 (+0000) Subject: Fix accidential variable overriding in manualWordsTable X-Git-Tag: 1.31.0-rc.0~7477^2 X-Git-Url: http://git.cyclocoop.org/clavettes/images/siteon3.jpg?a=commitdiff_plain;h=3ac6ef57fb98511e58af84043e9ebcbdb56cffe6;p=lhc%2Fweb%2Fwiklou.git Fix accidential variable overriding in manualWordsTable It doesn't make sense to get a table passed in then ignore that one completely so it doesn't look like the intentional behavior, and regardless of this, the edited code is still more logical. Change-Id: I98bc841e982d328e268309c06fefd3d3ca9f6cd7 --- diff --git a/maintenance/language/zhtable/Makefile.py b/maintenance/language/zhtable/Makefile.py index 999f25c134..c88b09500d 100755 --- a/maintenance/language/zhtable/Makefile.py +++ b/maintenance/language/zhtable/Makefile.py @@ -248,7 +248,8 @@ def translate(text, conv_table): def manualWordsTable(path, conv_table, reconv_table): fp = open(path, 'r', encoding='U8') - reconv_table = {} + reconv_table = reconv_table.copy() + out_table = {} wordlist = [line.split('#')[0].strip() for line in fp] wordlist = list(set(wordlist)) wordlist.sort(key=lambda w: (len(w), w), reverse=True) @@ -257,9 +258,9 @@ def manualWordsTable(path, conv_table, reconv_table): new_word = translate(word, conv_table) rcv_word = translate(word, reconv_table) if word != rcv_word: - reconv_table[word] = word - reconv_table[new_word] = word - return reconv_table + reconv_table[word] = out_table[word] = word + reconv_table[new_word] = out_table[new_word] = word + return out_table def defaultWordsTable(src_wordlist, src_tomany, char_conv_table,