From b5eaa9445d74e5c82161f0b495920d1027c8833e Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 15 May 2016 20:59:28 -0400 Subject: [PATCH] Python 3 genexpr bug --- test/bytecode_3.5/08_genexpr.pyc | Bin 0 -> 283 bytes test/bytecode_3.5/10_genexpr.pyc | Bin 0 -> 556 bytes test/simple_source/expression/08_genexpr.py | 10 ++++++++++ test/simple_source/expression/10_genexpr.py | 11 +++++++++++ uncompyle6/parsers/parse3.py | 5 ++--- 5 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 test/bytecode_3.5/08_genexpr.pyc create mode 100644 test/bytecode_3.5/10_genexpr.pyc create mode 100644 test/simple_source/expression/08_genexpr.py create mode 100644 test/simple_source/expression/10_genexpr.py diff --git a/test/bytecode_3.5/08_genexpr.pyc b/test/bytecode_3.5/08_genexpr.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bb405497b04378bec418ed3613c373225fc5adfb GIT binary patch literal 283 zcmWgR<>k7;Y8fub$iVQJ0SPbx*$zNlEDj`6fQXTyg@GZJfx)Gjks*qaA%%${Sd%#! zs0|E2%9(*U8HkIefkX`hL#!Y}Eh9q-SUXTt7-Jzb$e3VFCO1D##wh-@{G!~%lHB~f zl8n5>+*D1bTTFTew-~cmG8BP~`lVK!nOl&P8eg1WT9llspIT8+lv-SznV+X`U=g35 zng*lZ+%1*q;8hfQvN MN@-3i!URr609M00X#fBK literal 0 HcmV?d00001 diff --git a/test/bytecode_3.5/10_genexpr.pyc b/test/bytecode_3.5/10_genexpr.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1840f081c434ee282090c4e6de16fc9e003b5682 GIT binary patch literal 556 zcmYjN%Sr=55UiQqJV8YTK_N#UbBR$;LI@&3@RCbFVNqn+otWr8l9>%jBsoRYU-3`; zhP`_77jm*^BWg2U+dWiw)y~$+O1ZRidi}wGPy7pu>N85cN#N6A@Hw6t9I7p}h5cnH zo&ghiN}JO3`jTLLjs$oE9vI#jrW|uR49(jE+;Ge+%xt^@uM8djv;GB0IGV(owv7S@u*}ike;3dJubVpc~a+rm)hIjE139ZX%s^!}8sU zJ|>!sd{;U7%&iuAWu8~%2vQcNte09U9;G?+A6l755&Vy$3WitylP*%P4GV0SZ7{V; YRZA?t+4MiiW{dSO_J@INWRqs_8*~DCMgRZ+ literal 0 HcmV?d00001 diff --git a/test/simple_source/expression/08_genexpr.py b/test/simple_source/expression/08_genexpr.py new file mode 100644 index 00000000..3531a14a --- /dev/null +++ b/test/simple_source/expression/08_genexpr.py @@ -0,0 +1,10 @@ +# Bug in Python 3.5.1 calendar.py + +# expr ::= LOAD_NAME +# get_iter ::= expr GET_ITER +# expr ::= get_iter +# genexpr ::= LOAD_GENEXPR LOAD_CONST MAKE_FUNCTION_0 expr GET_ITER CALL_FUNCTION_1 +# expr ::= genexpr + +names = (formatmonthname(False) + for k in __file__) diff --git a/test/simple_source/expression/10_genexpr.py b/test/simple_source/expression/10_genexpr.py new file mode 100644 index 00000000..57cc2dd2 --- /dev/null +++ b/test/simple_source/expression/10_genexpr.py @@ -0,0 +1,11 @@ +# From Python 3.4 calendar + +# load_closure ::= LOAD_CLOSURE +# load_closure ::= load_closure LOAD_CLOSURE +# expr ::= LOAD_GLOBAL +# get_iter ::= expr GET_ITER +# genexpr ::= load_closure LOAD_GENEXPR LOAD_CONST MAKE_CLOSURE_0 expr GET_ITER CALL_FUNCTION_ +def formatyear(self, theyear, m=3): + for (i, row) in enumerate(self.yeardays2calendar(theyear, m)): + names = (self.formatmonthname(theyear, k, colwidth, False) + for k in months) diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index a085e16b..72aa926a 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -358,11 +358,10 @@ class Python3Parser(PythonParser): ''' load_genexpr ::= LOAD_GENEXPR load_genexpr ::= BUILD_TUPLE_1 LOAD_GENEXPR LOAD_CONST - ''' - def p_genexpr2(self, args): - ''' + # Is there something general going on here? genexpr ::= LOAD_GENEXPR LOAD_CONST MAKE_FUNCTION_0 expr GET_ITER CALL_FUNCTION_1 + genexpr ::= load_closure LOAD_GENEXPR LOAD_CONST MAKE_CLOSURE_0 expr GET_ITER CALL_FUNCTION_1 ''' def p_expr3(self, args):