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
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/TGPIOEG6RL6SDOZOMBVDFKZBYLDIVLX7/
Code of Conduct: http://python.org/psf/codeofconduct/