#13301: use ast.literal_eval() instead of eval() in Tools/i18n/msgfmt.py. Patch by Serhiy Storchaka.

This commit is contained in:
Ezio Melotti 2012-11-09 11:46:19 +01:00
parent 090177676a
commit dc118790de
2 changed files with 9 additions and 3 deletions

View File

@ -530,6 +530,12 @@ Build
- Issue #14437: Fix building the _io module under Cygwin. - 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 Documentation
------------- -------------

View File

@ -25,8 +25,9 @@ Options:
Display version information and exit. Display version information and exit.
""" """
import sys
import os import os
import sys
import ast
import getopt import getopt
import struct import struct
import array import array
@ -170,8 +171,7 @@ def make(filename, outfile):
l = l.strip() l = l.strip()
if not l: if not l:
continue continue
# XXX: Does this always follow Python escape semantics? l = ast.literal_eval(l)
l = eval(l)
if section == ID: if section == ID:
msgid += l msgid += l
elif section == STR: elif section == STR: