[pypy-commit] pypy pep526: Add AST validator for AnnAssign.

alcarithemad pypy.commits at gmail.com
Thu Mar 1 05:07:52 EST 2018


Author: Colin Valliant <alcarithemad at gmail.com>
Branch: pep526
Changeset: r93915:9bfa5258df88
Date: 2018-02-13 23:24 -0800
http://bitbucket.org/pypy/pypy/changeset/9bfa5258df88/

Log:	Add AST validator for AnnAssign.

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
@@ -212,6 +212,12 @@
         self._validate_exprs(node.targets, ast.Store)
         self._validate_expr(node.value)
 
+    def visit_AnnAssign(self, node):
+        self._validate_expr(node.target, ast.Store)
+        self._validate_expr(node.annotation)
+        if node.value:
+            self._validate_expr(node.value)
+
     def visit_AugAssign(self, node):
         self._validate_expr(node.target, ast.Store)
         self._validate_expr(node.value)


More information about the pypy-commit mailing list