Commits

Philip Jenvey committed f0974e2

fix handling of BoolOp.values when it's None

Comments (0)

Files changed (2)

pypy/interpreter/astcompiler/test/test_validate.py

     def test_boolop(self):
         b = ast.BoolOp(ast.And, [], 0, 0)
         self.expr(b, "less than 2 values")
+        b = ast.BoolOp(ast.And, None, 0, 0)
+        self.expr(b, "less than 2 values")
         b = ast.BoolOp(ast.And, [ast.Num(self.space.wrap(3), 0, 0)], 0, 0)
         self.expr(b, "less than 2 values")
         b = ast.BoolOp(ast.And, [ast.Num(self.space.wrap(4), 0, 0), None], 0, 0)

pypy/interpreter/astcompiler/validate.py

         pass
 
     def visit_BoolOp(self, node):
-        if len(node.values) < 2:
+        if self._len(node.values) < 2:
             raise ValidationError("BoolOp with less than 2 values")
         self._validate_exprs(node.values)