[pypy-commit] pypy py3.3: fix handling of BoolOp.values when it's None

pjenvey noreply at buildbot.pypy.org
Sun Aug 17 03:07:16 CEST 2014


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3.3
Changeset: r72838:f0974e24fc50
Date: 2014-08-16 18:04 -0700
http://bitbucket.org/pypy/pypy/changeset/f0974e24fc50/

Log:	fix handling of BoolOp.values when it's None

diff --git a/pypy/interpreter/astcompiler/test/test_validate.py b/pypy/interpreter/astcompiler/test/test_validate.py
--- a/pypy/interpreter/astcompiler/test/test_validate.py
+++ b/pypy/interpreter/astcompiler/test/test_validate.py
@@ -237,6 +237,8 @@
     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)
diff --git a/pypy/interpreter/astcompiler/validate.py b/pypy/interpreter/astcompiler/validate.py
--- a/pypy/interpreter/astcompiler/validate.py
+++ b/pypy/interpreter/astcompiler/validate.py
@@ -295,7 +295,7 @@
         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)
 


More information about the pypy-commit mailing list