From c60bbd87b8d8604d64ea53b151739b9bef8fad09 Mon Sep 17 00:00:00 2001 From: Calvin Li Date: Mon, 28 Jan 2019 15:14:32 -0800 Subject: [PATCH] check if ast.JoinedStr exists before using it ast.JoinedStr is new in Python3.6 (it's f-strings), it does not exist in Pythons below that --- bandit/plugins/injection_sql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bandit/plugins/injection_sql.py b/bandit/plugins/injection_sql.py index 3efa0a5dc..c8dbf0624 100644 --- a/bandit/plugins/injection_sql.py +++ b/bandit/plugins/injection_sql.py @@ -94,7 +94,7 @@ def _evaluate_ast(node): statement = node.s # Hierarchy for "".format() is Wrapper -> Call -> Attribute -> Str wrapper = node.parent.parent.parent - elif isinstance(node.parent, ast.JoinedStr): + elif hasattr(ast, 'JoinedStr') and isinstance(node.parent, ast.JoinedStr): statement = node.s wrapper = node.parent.parent