diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-10-03 20:28:47 +0000 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-10-03 20:28:47 +0000 |
commit | 4fac70683366ff65cdc3acf609246bf69c8ff61b (patch) | |
tree | 534575ad2b8f6a148aacf4a07744a189ec447f7e /Python/ast.c | |
parent | 01c549642a2b9e11c745e3572a8801dcc580b2ae (diff) | |
download | cpython-git-4fac70683366ff65cdc3acf609246bf69c8ff61b.tar.gz |
Merged revisions 75224 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r75224 | benjamin.peterson | 2009-10-03 15:27:13 -0500 (Sat, 03 Oct 2009) | 9 lines
Merged revisions 75223 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r75223 | benjamin.peterson | 2009-10-03 15:23:24 -0500 (Sat, 03 Oct 2009) | 1 line
#7050 fix a SystemError when using tuple unpacking and augmented assignment
........
................
Diffstat (limited to 'Python/ast.c')
-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 83572ee882..b0684c5730 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -2105,6 +2105,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) |