Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9bf379e

Browse files
committed
#13301: use ast.literal_eval() instead of eval() in Tools/i18n/msgfmt.py. Patch by Serhiy Storchaka.
1 parent 8b6b176 commit 9bf379e

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

Misc/NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,12 @@ Build
682682

683683
- Issue #14018: Fix OS X Tcl/Tk framework checking when using OS X SDKs.
684684

685+
Tools/Demos
686+
-----------
687+
688+
- Issue #13301: use ast.literal_eval() instead of eval() in Tools/i18n/msgfmt.py
689+
Patch by Serhiy Storchaka.
690+
685691
Documentation
686692
-------------
687693

Tools/i18n/msgfmt.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
Display version information and exit.
2525
"""
2626

27-
import sys
2827
import os
28+
import sys
29+
import ast
2930
import getopt
3031
import struct
3132
import array
@@ -180,8 +181,7 @@ def make(filename, outfile):
180181
l = l.strip()
181182
if not l:
182183
continue
183-
# XXX: Does this always follow Python escape semantics?
184-
l = eval(l)
184+
l = ast.literal_eval(l)
185185
if section == ID:
186186
msgid += l.encode(encoding)
187187
elif section == STR:

0 commit comments

Comments
 (0)