| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6fcc768 commit 660cd66
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,12 +42,7 @@ | |||
| 42 | 42 | ||
| 43 | 43 | _string_type_nodes = (ast.Str, ast.Bytes) if py3 else (ast.Str,) | |
| 44 | 44 | _numeric_types = (int, float, complex) + (() if py3 else (long,)) | |
| 45 | - | ||
| 46 | - # added in Python 3.4 | ||
| 47 | - if hasattr(ast, "NameConstant"): | ||
| 48 | - _name_type_nodes = (ast.Name, ast.NameConstant) | ||
| 49 | - else: | ||
| 50 | - _name_type_nodes = (ast.Name,) | ||
| 45 | + _name_type_nodes = (ast.Name, ast.NameConstant) if py3 else (ast.Name,) | ||
| 51 | 46 | ||
| 52 | 47 | ||
| 53 | 48 | class EvaluationError(Exception): | |
@@ -98,7 +93,7 @@ def simple_eval(node_or_string, namespace=None): | |||
| 98 | 93 | node_or_string = node_or_string.body | |
| 99 | 94 | ||
| 100 | 95 | def _convert(node): | |
| 101 | - if sys.version_info[:2] >= (3, 6) and isinstance(node, ast.Constant): | ||
| 96 | + if py3 and isinstance(node, ast.Constant): | ||
| 102 | 97 | return node.value | |
| 103 | 98 | if isinstance(node, _string_type_nodes): | |
| 104 | 99 | return node.s | |
| Back | FazBrowse Home | New Git URL |
0 commit comments