Skip to content

Commit

Permalink
Use ast.literal_eval to implement safeEval
Browse files Browse the repository at this point in the history
Fixes #75
  • Loading branch information
behdad committed Jan 14, 2014
1 parent 972af5a commit f5d123b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Lib/fontTools/misc/textTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit f5d123b

Please sign in to comment.