You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Python 3.2 & 3.3 handle STORE_NAME better
This commit is contained in:
9
test/simple_source/bug33/05_store_name.py
Normal file
9
test/simple_source/bug33/05_store_name.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# From 3.3.5 turtledemo/bytedesign.py
|
||||||
|
# Python 3.2 and 3.3 adds this funny
|
||||||
|
# LOAD_FAST STORE_LOCALS
|
||||||
|
# which we translate to
|
||||||
|
# # inspect.currentframe().f_locals = __locals__
|
||||||
|
from turtle import Turtle
|
||||||
|
class Designer(Turtle):
|
||||||
|
def design(self, homePos, scale):
|
||||||
|
pass
|
@@ -0,0 +1,3 @@
|
|||||||
|
# Bug from Python 3.4 asyncio/tasks.py
|
||||||
|
def as_completed(fs, *, loop=None):
|
||||||
|
todo = {async(f, loop=loop) for f in set(fs)}
|
@@ -570,14 +570,16 @@ class Python32Parser(Python3Parser):
|
|||||||
def p_32(self, args):
|
def p_32(self, args):
|
||||||
"""
|
"""
|
||||||
# Store locals is only in Python 3.2 and 3.3
|
# Store locals is only in Python 3.2 and 3.3
|
||||||
designator ::= STORE_LOCALS
|
stmt ::= store_locals
|
||||||
|
store_locals ::= LOAD_FAST STORE_LOCALS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class Python33Parser(Python3Parser):
|
class Python33Parser(Python3Parser):
|
||||||
def p_33(self, args):
|
def p_33(self, args):
|
||||||
"""
|
"""
|
||||||
# Store locals is only in Python 3.2 and 3.3
|
# Store locals is only in Python 3.2 and 3.3
|
||||||
designator ::= STORE_LOCALS
|
stmt ::= store_locals
|
||||||
|
store_locals ::= LOAD_FAST STORE_LOCALS
|
||||||
|
|
||||||
# Python 3.3 adds yield from.
|
# Python 3.3 adds yield from.
|
||||||
expr ::= yield_from
|
expr ::= yield_from
|
||||||
|
@@ -369,6 +369,11 @@ TABLE_DIRECT = {
|
|||||||
'importmultiple': ( '%|import %c%c\n', 2, 3 ),
|
'importmultiple': ( '%|import %c%c\n', 2, 3 ),
|
||||||
'import_cont' : ( ', %c', 2 ),
|
'import_cont' : ( ', %c', 2 ),
|
||||||
|
|
||||||
|
########################
|
||||||
|
# Python 3.2 and 3.3 only
|
||||||
|
#######################
|
||||||
|
'store_locals': ( '%|# inspect.currentframe().f_locals = __locals__\n', ),
|
||||||
|
|
||||||
########################
|
########################
|
||||||
# Python 3.4+ Additions
|
# Python 3.4+ Additions
|
||||||
#######################
|
#######################
|
||||||
|
Reference in New Issue
Block a user