mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2024-11-27 07:00:42 +00:00
Python 2.2 doesn't have opcode LIST_APPEND
This commit is contained in:
parent
98a6f47ad6
commit
31413be7a1
BIN
test/bytecode_2.2/05_test_yield.pyc
Normal file
BIN
test/bytecode_2.2/05_test_yield.pyc
Normal file
Binary file not shown.
24
test/simple_source/bug22/05_test_yield.py
Normal file
24
test/simple_source/bug22/05_test_yield.py
Normal file
@ -0,0 +1,24 @@
|
||||
# From decompyle
|
||||
# In Python 2.2 we don't have op LIST_APPEND while in > 2.3 we do.
|
||||
|
||||
from __future__ import generators
|
||||
|
||||
def inorder(t):
|
||||
if t:
|
||||
for x in inorder(t.left):
|
||||
yield x
|
||||
|
||||
yield t.label
|
||||
for x in inorder(t.right):
|
||||
yield x
|
||||
|
||||
def generate_ints(n):
|
||||
for i in range(n):
|
||||
yield i * 2
|
||||
|
||||
for i in generate_ints(5):
|
||||
print i,
|
||||
|
||||
print
|
||||
gen = generate_ints(3)
|
||||
print gen.next(), gen.next(), gen.next(), gen.next()
|
@ -381,7 +381,8 @@ class Scanner2(scan.Scanner):
|
||||
j = self.prev[s]
|
||||
while code[j] == self.opc.JUMP_ABSOLUTE:
|
||||
j = self.prev[j]
|
||||
if code[j] == self.opc.LIST_APPEND: # list comprehension
|
||||
if (self.version >= 2.3 and
|
||||
code[j] == self.opc.LIST_APPEND): # list comprehension
|
||||
stmts.remove(s)
|
||||
continue
|
||||
elif code[s] == self.opc.POP_TOP and code[self.prev[s]] == self.opc.ROT_TWO:
|
||||
|
Loading…
Reference in New Issue
Block a user