Mercurial > cpython-lru_cache-weakref
diff Python/ast.c @ 56361:cceb62eb1cf1 legacy-trunk
#7050 fix a SystemError when using tuple unpacking and augmented assignment
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Sat, 03 Oct 2009 20:23:24 +0000 |
| parents | 1e2877026435 |
| children | e99adfc92dc2 |
line wrap: on
line diff
--- a/Python/ast.c Sat Oct 03 14:52:33 2009 +0000 +++ b/Python/ast.c Sat Oct 03 20:23:24 2009 +0000 @@ -2097,6 +2097,19 @@ 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)
