Issue #27985: Implement PEP 526 -- Syntax for Variable Annotations. · python/cpython@f8cb8a1 (original) (raw)
`@@ -65,11 +65,12 @@ struct _mod {
`
65
65
``
66
66
`enum _stmt_kind {FunctionDef_kind=1, AsyncFunctionDef_kind=2, ClassDef_kind=3,
`
67
67
`Return_kind=4, Delete_kind=5, Assign_kind=6,
`
68
``
`-
AugAssign_kind=7, For_kind=8, AsyncFor_kind=9, While_kind=10,
`
69
``
`-
If_kind=11, With_kind=12, AsyncWith_kind=13, Raise_kind=14,
`
70
``
`-
Try_kind=15, Assert_kind=16, Import_kind=17,
`
71
``
`-
ImportFrom_kind=18, Global_kind=19, Nonlocal_kind=20,
`
72
``
`-
Expr_kind=21, Pass_kind=22, Break_kind=23, Continue_kind=24};
`
``
68
`+
AugAssign_kind=7, AnnAssign_kind=8, For_kind=9,
`
``
69
`+
AsyncFor_kind=10, While_kind=11, If_kind=12, With_kind=13,
`
``
70
`+
AsyncWith_kind=14, Raise_kind=15, Try_kind=16,
`
``
71
`+
Assert_kind=17, Import_kind=18, ImportFrom_kind=19,
`
``
72
`+
Global_kind=20, Nonlocal_kind=21, Expr_kind=22, Pass_kind=23,
`
``
73
`+
Break_kind=24, Continue_kind=25};
`
73
74
`struct _stmt {
`
74
75
`enum _stmt_kind kind;
`
75
76
`union {
`
`@@ -116,6 +117,13 @@ struct _stmt {
`
116
117
`expr_ty value;
`
117
118
` } AugAssign;
`
118
119
``
``
120
`+
struct {
`
``
121
`+
expr_ty target;
`
``
122
`+
expr_ty annotation;
`
``
123
`+
expr_ty value;
`
``
124
`+
int simple;
`
``
125
`+
} AnnAssign;
`
``
126
+
119
127
`struct {
`
120
128
`expr_ty target;
`
121
129
`expr_ty iter;
`
`@@ -461,6 +469,9 @@ stmt_ty _Py_Assign(asdl_seq * targets, expr_ty value, int lineno, int
`
461
469
`#define AugAssign(a0, a1, a2, a3, a4, a5) _Py_AugAssign(a0, a1, a2, a3, a4, a5)
`
462
470
`stmt_ty _Py_AugAssign(expr_ty target, operator_ty op, expr_ty value, int
`
463
471
`lineno, int col_offset, PyArena *arena);
`
``
472
`+
#define AnnAssign(a0, a1, a2, a3, a4, a5, a6) _Py_AnnAssign(a0, a1, a2, a3, a4, a5, a6)
`
``
473
`+
stmt_ty _Py_AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int
`
``
474
`+
simple, int lineno, int col_offset, PyArena *arena);
`
464
475
`#define For(a0, a1, a2, a3, a4, a5, a6) _Py_For(a0, a1, a2, a3, a4, a5, a6)
`
465
476
`stmt_ty _Py_For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq *
`
466
477
`orelse, int lineno, int col_offset, PyArena *arena);
`