Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: flake8-eyeo/flake8_eyeo.py

Issue 29565854: Noissue - Improved accuracy of evaluated expressions for A103 and A207 (Closed)
Patch Set: Created Oct. 5, 2017, 9:41 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | flake8-eyeo/tests/A103.py » ('j') | flake8-eyeo/tests/A103.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: flake8-eyeo/flake8_eyeo.py
===================================================================
--- a/flake8-eyeo/flake8_eyeo.py
+++ b/flake8-eyeo/flake8_eyeo.py
@@ -47,8 +47,9 @@
def evaluate(node):
+ names = {'__builtins__': {'True': True, 'False': False, 'None': None}}
tlucas 2017/10/06 11:41:36 Why are these values necessary? From what i under
Sebastian Noack 2017/10/06 18:11:09 True, False and None are special. They are the onl
try:
- return eval(compile(ast.Expression(node), '', 'eval'), {})
+ return eval(compile(ast.Expression(node), '', 'eval'), names)
except Exception:
return VOLATILE
« no previous file with comments | « no previous file | flake8-eyeo/tests/A103.py » ('j') | flake8-eyeo/tests/A103.py » ('J')

Powered by Google App Engine
This is Rietveld