Python 3.2 & 3.3 handle STORE_NAME better

This commit is contained in:
rocky
2016-07-11 23:24:52 -04:00
parent 55b269f744
commit 78f24f9c66
4 changed files with 21 additions and 2 deletions

View 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

View File

@@ -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)}

View File

@@ -570,14 +570,16 @@ class Python32Parser(Python3Parser):
def p_32(self, args):
"""
# 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):
def p_33(self, args):
"""
# 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.
expr ::= yield_from

View File

@@ -369,6 +369,11 @@ TABLE_DIRECT = {
'importmultiple': ( '%|import %c%c\n', 2, 3 ),
'import_cont' : ( ', %c', 2 ),
########################
# Python 3.2 and 3.3 only
#######################
'store_locals': ( '%|# inspect.currentframe().f_locals = __locals__\n', ),
########################
# Python 3.4+ Additions
#######################