Use ast.literal_eval to implement safeEval
Fixes https://github.com/behdad/fonttools/issues/75
This commit is contained in:
parent
972af5af63
commit
f5d123be5e
@ -3,13 +3,11 @@
|
||||
|
||||
from __future__ import print_function, division
|
||||
from fontTools.misc.py23 import *
|
||||
import ast
|
||||
import string
|
||||
|
||||
|
||||
def safeEval(data, eval=eval):
|
||||
"""A (kindof) safe replacement for eval."""
|
||||
return eval(data, {"__builtins__":{}})
|
||||
|
||||
safeEval = ast.literal_eval
|
||||
|
||||
def readHex(content):
|
||||
"""Convert a list of hex strings to binary data."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user