forked from killvxk/pycdc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support chained assignment statements, e.g.
a = b = c
.
We know when we have begun a chained assignment when we process a DUP_TOP with non-null on the stack. Push a NODE_CHAINSTORE onto the stack when this happens, and keep it 'floating' on top of the stack for all STORE_X operations until the stack is empty. To support versions of Python <= 2.5 which use DUP_TOP in more places, I modified ROT_TWO, ROT_THREE and ROT_FOUR to get rid of NODE_CHAINSTORE on the stack if it is present.
- Loading branch information
Showing
7 changed files
with
200 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
a = [y, z] = x = (k1, k2, k3) = [] = c = myfunc(x) + 3 | ||
|
||
x = y = g = {keyA: X} | ||
|
||
global store_global | ||
Gx = Gy = Gz = Gq1 | ||
Gx = [Gy, Gz] = Gq2 | ||
a = b = store_global = c | ||
|
||
def func_with_global(): | ||
global Gx, Gy, Gz, Gq | ||
Gx = Gy = Gz = Gq | ||
|
||
y = store_subscr[0] = x | ||
a[0] = b[x] = c[3] = D[4] | ||
a[0] = (b[x], c[3]) = D[4] | ||
a[0] = Q = [b[x], c[3]] = F = D[4] | ||
q = v = arr[a:b:c] = x | ||
|
||
class store_attr1: | ||
def __init__(self, a,b,c): | ||
self.a = self.b = self.c = x | ||
self.d = y | ||
|
||
class store_attr2: | ||
def __init__(self, a,b,c): self.a = (self.b, self.c) = x | ||
|
||
a.b = c.d = e.f + g.h | ||
|
||
def store_deref(): | ||
a = I | ||
a = b = c = R1 | ||
a = (b, c) = R2 | ||
def store_fast(): | ||
x = a | ||
y = b | ||
z = c | ||
p = q = r = s | ||
p = [q, r] = s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
a = ( y , z ) = x = ( k1 , k2 , k3 ) = ( ) = c = myfunc ( x ) + 3 <EOL> | ||
x = y = g = { keyA : X } <EOL> | ||
Gx = Gy = Gz = Gq1 <EOL> | ||
Gx = ( Gy , Gz ) = Gq2 <EOL> | ||
a = b = store_global = c <EOL> | ||
def func_with_global ( ) : <EOL> | ||
<INDENT> | ||
global Gx , Gy , Gz <EOL> | ||
Gx = Gy = Gz = Gq <EOL> | ||
<OUTDENT> | ||
y = store_subscr [ 0 ] = x <EOL> | ||
a [ 0 ] = b [ x ] = c [ 3 ] = D [ 4 ] <EOL> | ||
a [ 0 ] = ( b [ x ] , c [ 3 ] ) = D [ 4 ] <EOL> | ||
a [ 0 ] = Q = ( b [ x ] , c [ 3 ] ) = F = D [ 4 ] <EOL> | ||
q = v = arr [ a : b : c ] = x <EOL> | ||
class store_attr1 : <EOL> | ||
<INDENT> | ||
def __init__ ( self , a , b , c ) : <EOL> | ||
<INDENT> | ||
self . a = self . b = self . c = x <EOL> | ||
self . d = y <EOL> | ||
<OUTDENT> | ||
<OUTDENT> | ||
class store_attr2 : <EOL> | ||
<INDENT> | ||
def __init__ ( self , a , b , c ) : <EOL> | ||
<INDENT> | ||
self . a = ( self . b , self . c ) = x <EOL> | ||
<OUTDENT> | ||
<OUTDENT> | ||
a . b = c . d = e . f + g . h <EOL> | ||
def store_deref ( ) : <EOL> | ||
<INDENT> | ||
a = I <EOL> | ||
a = b = c = R1 <EOL> | ||
a = ( b , c ) = R2 <EOL> | ||
def store_fast ( ) : <EOL> | ||
<INDENT> | ||
x = a <EOL> | ||
y = b <EOL> | ||
z = c <EOL> | ||
p = q = r = s <EOL> | ||
p = ( q , r ) = s <EOL> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters