5 Sep
2020
5 Sep
'20
12:08 a.m.
On Fri, Sep 04, 2020 at 06:10:23PM -0400, Cade Brown wrote:
I mentioned that in my post; however it doesn't satisfy the problems I have (mainly being that eval(repr(x))==x)
Further to my previous comment, if you *absolutely must* use eval, you can mitigate some (but not all) security threats and solve your eval(repr) issue: # evaluate string `s` a little bit less dangerously if '_' in s: raise ValueError('underscore prohibited') else: eval(s, {'inf': math.inf, '__builtins__': None}) -- Steve