diff --git a/test/simple_source/bug33/05_store_name.py b/test/simple_source/bug33/05_store_name.py new file mode 100644 index 00000000..73fae37c --- /dev/null +++ b/test/simple_source/bug33/05_store_name.py @@ -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 diff --git a/test/simple_source/comprehension/05_3x_set_comphension.py b/test/simple_source/comprehension/05_3x_set_comphension.py new file mode 100644 index 00000000..dba84d0e --- /dev/null +++ b/test/simple_source/comprehension/05_3x_set_comphension.py @@ -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)} diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index 4c08ca80..db1c24fb 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -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 diff --git a/uncompyle6/semantics/pysource.py b/uncompyle6/semantics/pysource.py index 23b9f2ab..f16e4b7a 100644 --- a/uncompyle6/semantics/pysource.py +++ b/uncompyle6/semantics/pysource.py @@ -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 #######################