➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients serhiy.storchaka
Date 2018-02-21.09:56:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <[email protected]>
In-reply-to
Content
Currently ast.literal_eval() accepts AST representing expressions like "+True" or "True+2j" if constants are represented as Constant. This is because the type of the value is tested with `isinstance(left, (int, float))` and since bool is a subclass of int it passes this test.

The proposed PR makes ast.literal_eval() using tests for exact type. I don't think it is worth backporting since it affects only passing AST to ast.literal_eval(). Usually ast.literal_eval() is used for evaluating strings.
History
Date User Action Args
2018-02-21 09:56:21serhiy.storchakasetrecipients: + serhiy.storchaka
2018-02-21 09:56:21serhiy.storchakasetmessageid: <[email protected]>
2018-02-21 09:56:21serhiy.storchakalinkissue32893 messages
2018-02-21 09:56:21serhiy.storchakacreate