Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
7adbb5a3
Commit
7adbb5a3
authored
Oct 03, 2009
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#7050 fix a SystemError when using tuple unpacking and augmented assignment
parent
3b34dd87
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
+19
-0
Lib/test/test_augassign.py
Lib/test/test_augassign.py
+3
-0
Misc/NEWS
Misc/NEWS
+3
-0
Python/ast.c
Python/ast.c
+13
-0
No files found.
Lib/test/test_augassign.py
View file @
7adbb5a3
...
@@ -24,6 +24,9 @@ class AugAssignTest(unittest.TestCase):
...
@@ -24,6 +24,9 @@ class AugAssignTest(unittest.TestCase):
# new-style division (with -Qnew)
# new-style division (with -Qnew)
self
.
assertEquals
(
x
,
3.0
)
self
.
assertEquals
(
x
,
3.0
)
def
test_with_unpacking
(
self
):
self
.
assertRaises
(
SyntaxError
,
compile
,
"x, b += 3"
,
"<test>"
,
"exec"
)
def
testInList
(
self
):
def
testInList
(
self
):
x
=
[
2
]
x
=
[
2
]
x
[
0
]
+=
1
x
[
0
]
+=
1
...
...
Misc/NEWS
View file @
7adbb5a3
...
@@ -12,6 +12,9 @@ What's New in Python 2.7 alpha 1
...
@@ -12,6 +12,9 @@ What's New in Python 2.7 alpha 1
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #7050: Fix a SystemError when trying to use unpacking and augmented
assignment.
- Issue #5329: Fix os.popen* regression from 2.5 with commands as a
- Issue #5329: Fix os.popen* regression from 2.5 with commands as a
sequence running through the shell. Patch by Jean-Paul Calderone
sequence running through the shell. Patch by Jean-Paul Calderone
and Jani Hakala.
and Jani Hakala.
...
...
Python/ast.c
View file @
7adbb5a3
...
@@ -2097,6 +2097,19 @@ ast_for_expr_stmt(struct compiling *c, const node *n)
...
@@ -2097,6 +2097,19 @@ ast_for_expr_stmt(struct compiling *c, const node *n)
return
NULL
;
return
NULL
;
if
(
!
set_context
(
c
,
expr1
,
Store
,
ch
))
if
(
!
set_context
(
c
,
expr1
,
Store
,
ch
))
return
NULL
;
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
);
ch
=
CHILD
(
n
,
2
);
if
(
TYPE
(
ch
)
==
testlist
)
if
(
TYPE
(
ch
)
==
testlist
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment