summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2012-11-09 10:51:03 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2012-11-09 10:51:03 (GMT)
commit956c6c2dabe893e5c389d3d84a614aae469851e3 (patch)
tree45f7c09821b8874357b8642ed0969e4c6fcc5f8a
parenta3ad8a0ce7e87a36886410c9314d3f338e844048 (diff)
parent9bf379e9fbbd669cfbf61adc6b833a9bbe023238 (diff)
downloadcpython-956c6c2dabe893e5c389d3d84a614aae469851e3.zip
cpython-956c6c2dabe893e5c389d3d84a614aae469851e3.tar.gz
cpython-956c6c2dabe893e5c389d3d84a614aae469851e3.tar.bz2
#13301: merge with 3.2.
-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 e09e67d..bf201cf 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -227,6 +227,12 @@ Build
- Issue #15819: Make sure we can build Python out-of-tree from a read-only
source directory. (Somewhat related to issue #9860.)
+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 a554442..7b3a81f 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: