Skip to content

Commit

Permalink
Fix 'assert' statement contains an expression with side effects
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Mar 25, 2021
1 parent 59154d4 commit cb3ea62
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pylint/checkers/python3.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,13 +949,15 @@ def visit_if(self, node):
self._branch_stack.append(Branch(node, self._is_py2_test(node)))

def leave_if(self, node):
assert self._branch_stack.pop().node == node
new_node = self._branch_stack.pop().node
assert new_node == node

def visit_ifexp(self, node):
self._branch_stack.append(Branch(node, self._is_py2_test(node)))

def leave_ifexp(self, node):
assert self._branch_stack.pop().node == node
new_node = self._branch_stack.pop()
assert new_node.node == node

def visit_module(self, node): # pylint: disable=unused-argument
"""Clear checker state after previous module."""
Expand Down

0 comments on commit cb3ea62

Please sign in to comment.