diff --git a/test/bytecode_3.6/02_genexpr.pyc b/test/bytecode_3.6/02_genexpr.pyc new file mode 100644 index 00000000..70485396 Binary files /dev/null and b/test/bytecode_3.6/02_genexpr.pyc differ diff --git a/test/simple_source/bug36/02_genexpr.py b/test/simple_source/bug36/02_genexpr.py new file mode 100644 index 00000000..9ea0dea8 --- /dev/null +++ b/test/simple_source/bug36/02_genexpr.py @@ -0,0 +1,5 @@ +# Python 3.6, uses rule: +# genexpr ::= load_closure load_genexpr LOAD_CONST +# MAKE_FUNCTION_8 expr GET_ITER CALL_FUNCTION_1 +def __sub__(self, other): # SList()-other + return self.__class__(i for i in self if i not in other) diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index 7280ed3e..5c3d82c3 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -886,6 +886,12 @@ class Python3Parser(PythonParser): 'LOAD_CONST ' * 2, opname)) self.add_unique_rule(rule, opname, token.attr, customize) + + if has_get_iter_call_function1: + rule_pat = ("genexpr ::= %sload_closure load_genexpr %%s%s expr " + "GET_ITER CALL_FUNCTION_1" % ('pos_arg '* args_pos, opname)) + self.add_make_function_rule(rule_pat, opname, token.attr, customize) + rule_pat = ('mklambda ::= %s%sLOAD_LAMBDA %%s%s' % (('pos_arg '* args_pos), ('kwarg '* args_kw),