diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2012-11-09 10:46:19 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2012-11-09 10:46:19 (GMT) |
commit | dc118790de7e608851e646d8b28020122707d31a (patch) | |
tree | de65a264537836d62014023a72b61e6dc54a6c2a | |
parent | 090177676a0449bc5625fc4fdc870b7c9a9f913a (diff) | |
download | cpython-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/NEWS | 6 | ||||
-rwxr-xr-x | Tools/i18n/msgfmt.py | 6 |
2 files changed, 9 insertions, 3 deletions
@@ -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: |