From cb3ea625c2f9f70667a074aa6603b3ea68e9d18e Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Wed, 24 Mar 2021 22:04:20 +0100 Subject: [PATCH] Fix 'assert' statement contains an expression with side effects --- pylint/checkers/python3.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pylint/checkers/python3.py b/pylint/checkers/python3.py index 3daaf99277..d3943ad375 100644 --- a/pylint/checkers/python3.py +++ b/pylint/checkers/python3.py @@ -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."""