05.09.20 01:43, Greg Ewing пише:
> On 5/09/20 10:15 am, Chris Angelico wrote:
>> Remember that if this matters to you, you can "from math import inf".
> 
> But you still need to use full eval on your repr, which could
> be a serious security problem in some contexts. If it were a
> built-in constant, ast.literal_eval could be used instead.

It is better to use float() instead of ast.literal_eval().
ast.literal_eval() is not a "safe eval", it can crash the interpreter or
use enormous CPU time. It can be used to organize DOS attacks.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/5FVYI4ROFTHVRVWFGU427VILUON35YOL/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to