summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2012-11-09 10:46:19 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2012-11-09 10:46:19 (GMT)
commitdc118790de7e608851e646d8b28020122707d31a (patch)
treede65a264537836d62014023a72b61e6dc54a6c2a
parent090177676a0449bc5625fc4fdc870b7c9a9f913a (diff)
downloadcpython-dc118790de7e608851e646d8b28020122707d31a.zip
cpython-dc118790de7e608851e646d8b28020122707d31a.tar.gz
cpython-dc118790de7e608851e646d8b28020122707d31a.tar.bz2
#13301: use ast.literal_eval() instead of eval() in Tools/i18n/msgfmt.py. Patch by Serhiy Storchaka.
-rw-r--r--Misc/NEWS6
-rwxr-xr-xTools/i18n/msgfmt.py6
2 files changed, 9 insertions, 3 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 16ddf41..d8821b0 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -530,6 +530,12 @@ Build
- Issue #14437: Fix building the _io module under Cygwin.
+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 5dd5430..8c9b9dc 100755
--- a/Tools/i18n/msgfmt.py
+++ b/Tools/i18n/msgfmt.py
@@ -25,8 +25,9 @@ Options:
Display version information and exit.
"""
-import sys
import os
+import sys
+import ast
import getopt
import struct
import array
@@ -170,8 +171,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
elif section == STR: