From: Ezio Melotti Date: Fri, 9 Nov 2012 10:46:19 +0000 (+0100) Subject: #13301: use ast.literal_eval() instead of eval() in Tools/i18n/msgfmt.py. Patch... X-Git-Tag: v3.2.4rc1~357 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9bf379e9fbbd669cfbf61adc6b833a9bbe023238;p=thirdparty%2FPython%2Fcpython.git #13301: use ast.literal_eval() instead of eval() in Tools/i18n/msgfmt.py. Patch by Serhiy Storchaka. --- diff --git a/Misc/NEWS b/Misc/NEWS index 6901beccf550..6cfa567db47f 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -682,6 +682,12 @@ Build - Issue #14018: Fix OS X Tcl/Tk framework checking when using OS X SDKs. +Tools/Demos +----------- + +- Issue #13301: use ast.literal_eval() instead of eval() in Tools/i18n/msgfmt.py + Patch by Serhiy Storchaka. + Documentation ------------- diff --git a/Tools/i18n/msgfmt.py b/Tools/i18n/msgfmt.py index a5544424e243..7b3a81ff93ac 100755 --- a/Tools/i18n/msgfmt.py +++ b/Tools/i18n/msgfmt.py @@ -24,8 +24,9 @@ Options: Display version information and exit. """ -import sys import os +import sys +import ast import getopt import struct import array @@ -180,8 +181,7 @@ def make(filename, outfile): l = l.strip() if not l: continue - # XXX: Does this always follow Python escape semantics? - l = eval(l) + l = ast.literal_eval(l) if section == ID: msgid += l.encode(encoding) elif section == STR: