diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-10-03 20:23:24 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-10-03 20:23:24 (GMT) |
commit | 7adbb5a35da601fc68255eeaf341ad734e86a9bf (patch) | |
tree | 0b5505e6b465b27e5ecd5f523c9d9e7a6aa1b1c3 /Python | |
parent | 3b34dd871a3d17aa382d4ca22488671afe0c4c03 (diff) | |
download | cpython-7adbb5a35da601fc68255eeaf341ad734e86a9bf.zip cpython-7adbb5a35da601fc68255eeaf341ad734e86a9bf.tar.gz cpython-7adbb5a35da601fc68255eeaf341ad734e86a9bf.tar.bz2 |
#7050 fix a SystemError when using tuple unpacking and augmented assignment
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Python/ast.c b/Python/ast.c index 2f975ac..3422c2e 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -2097,6 +2097,19 @@ ast_for_expr_stmt(struct compiling *c, const node *n) return NULL; if(!set_context(c, expr1, Store, ch)) return NULL; + /* set_context checks that most expressions are not the left side. + Augmented assignments can only have a name, a subscript, or an + attribute on the left, though, so we have to explicitly check for + those. */ + switch (expr1->kind) { + case Name_kind: + case Attribute_kind: + case Subscript_kind: + break; + default: + ast_error(ch, "illegal expression for augmented assignment"); + return NULL; + } ch = CHILD(n, 2); if (TYPE(ch) == testlist) |