Commits

Anonymous committed adb3841

used `safe_eval` to handle error in `parse_format` better.

  • Participants
  • Parent commits e2e852d

Comments (0)

Files changed (1)

rstspreadsheet.py

 
 
 def parse_format(argument):
-    return eval('{%s}' % ' '.join(argument.split('\n')))
+    (result, tb) = safe_eval('{%s}' % ' '.join(argument.split('\n')),
+                             _mix=False)
+    if tb is not None:
+        raise ValueError("fail to parse '{0}'".format(argument))
+    return result
 
 
 def new_paragraph(rawtext):