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
cb35b95f
Commit
cb35b95f
authored
Mar 14, 2006
by
Nick Coghlan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Teach the compiler module about augmented assignment to tuple subscripts
parent
7580146b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
4 deletions
+2
-4
Lib/compiler/pycodegen.py
Lib/compiler/pycodegen.py
+2
-4
No files found.
Lib/compiler/pycodegen.py
View file @
cb35b95f
...
@@ -1045,8 +1045,6 @@ class CodeGenerator:
...
@@ -1045,8 +1045,6 @@ class CodeGenerator:
self
.
emit
(
'STORE_SLICE+%d'
%
slice
)
self
.
emit
(
'STORE_SLICE+%d'
%
slice
)
def
visitAugSubscript
(
self
,
node
,
mode
):
def
visitAugSubscript
(
self
,
node
,
mode
):
if
len
(
node
.
subs
)
>
1
:
raise
SyntaxError
,
"augmented assignment to tuple is not possible"
if
mode
==
"load"
:
if
mode
==
"load"
:
self
.
visitSubscript
(
node
,
1
)
self
.
visitSubscript
(
node
,
1
)
elif
mode
==
"store"
:
elif
mode
==
"store"
:
...
@@ -1151,10 +1149,10 @@ class CodeGenerator:
...
@@ -1151,10 +1149,10 @@ class CodeGenerator:
self
.
visit
(
node
.
expr
)
self
.
visit
(
node
.
expr
)
for
sub
in
node
.
subs
:
for
sub
in
node
.
subs
:
self
.
visit
(
sub
)
self
.
visit
(
sub
)
if
aug_flag
:
self
.
emit
(
'DUP_TOPX'
,
2
)
if
len
(
node
.
subs
)
>
1
:
if
len
(
node
.
subs
)
>
1
:
self
.
emit
(
'BUILD_TUPLE'
,
len
(
node
.
subs
))
self
.
emit
(
'BUILD_TUPLE'
,
len
(
node
.
subs
))
if
aug_flag
:
self
.
emit
(
'DUP_TOPX'
,
2
)
if
node
.
flags
==
'OP_APPLY'
:
if
node
.
flags
==
'OP_APPLY'
:
self
.
emit
(
'BINARY_SUBSCR'
)
self
.
emit
(
'BINARY_SUBSCR'
)
elif
node
.
flags
==
'OP_ASSIGN'
:
elif
node
.
flags
==
'OP_ASSIGN'
:
...
...
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