Skip to content

Commit

Permalink
check if ast.JoinedStr exists before using it
Browse files Browse the repository at this point in the history
ast.JoinedStr is new in Python3.6 (it's f-strings), it does not exist in Pythons below that
  • Loading branch information
calvinli authored and ericwb committed Feb 3, 2019
1 parent 14a774e commit 5b244b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bandit/plugins/injection_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 5b244b1

Please sign in to comment.