mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2024-10-08 02:33:38 +00:00
Python 3 DUP_TOP_TWO bug
This commit is contained in:
parent
dddb486d78
commit
196495c40e
BIN
test/bytecode_3.2/05_dup_top_two.pyc
Normal file
BIN
test/bytecode_3.2/05_dup_top_two.pyc
Normal file
Binary file not shown.
6
test/simple_source/operation_logic/05_dup_top_two.py
Normal file
6
test/simple_source/operation_logic/05_dup_top_two.py
Normal file
@ -0,0 +1,6 @@
|
||||
# Bug in &= ~x in Python 3
|
||||
# Uses DUP_TOP_TWO in Python 3 and
|
||||
# DUP_TOPX_2 in Python 2
|
||||
import sys, termios
|
||||
new = sys.argv[:]
|
||||
new[3] &= ~termios.ECHO
|
@ -332,6 +332,9 @@ class Python2Parser(PythonParser):
|
||||
slice2 ::= expr expr DUP_TOPX_2 SLICE+2
|
||||
slice3 ::= expr expr expr SLICE+3
|
||||
slice3 ::= expr expr expr DUP_TOPX_3 SLICE+3
|
||||
|
||||
# In Python 3, DUP_TOPX_2 is DUP_TOP_TWO
|
||||
binary_subscr2 ::= expr expr DUP_TOPX_2 BINARY_SUBSCR
|
||||
'''
|
||||
|
||||
def add_custom_rules(self, tokens, customize):
|
||||
|
@ -344,6 +344,9 @@ class Python3Parser(PythonParser):
|
||||
# Python 3.3+ adds yield from
|
||||
expr ::= yield_from
|
||||
yield_from ::= expr expr YIELD_FROM
|
||||
|
||||
# In Python 2, DUP_TOP_TWO is DUP_TOPX_2
|
||||
binary_subscr2 ::= expr expr DUP_TOP_TWO BINARY_SUBSCR
|
||||
'''
|
||||
|
||||
@staticmethod
|
||||
|
Loading…
Reference in New Issue
Block a user