[Python-checkins] cpython (merge 3.2 -> 3.3): #13301: merge with 3.2.
ezio.melotti
python-checkins at python.org
Fri Nov 9 11:52:18 CET 2012
http://hg.python.org/cpython/rev/ea2cb9b69fd9
changeset: 80326:ea2cb9b69fd9
branch: 3.3
parent: 80322:8c7f2f6f3375
parent: 80325:2fa338374719
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Fri Nov 09 11:51:03 2012 +0100
summary:
#13301: merge with 3.2.
files:
Misc/NEWS | 6 ++++++
Tools/i18n/msgfmt.py | 6 +++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -227,6 +227,12 @@
- 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
--- a/Tools/i18n/msgfmt.py
+++ b/Tools/i18n/msgfmt.py
@@ -24,8 +24,9 @@
Display version information and exit.
"""
+import os
import sys
-import os
+import ast
import getopt
import struct
import array
@@ -180,8 +181,7 @@
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:
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list