From 9b806635292712906345c275931a023b83ca706f Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 7 May 2022 06:06:38 -0400 Subject: [PATCH] 3.6 async hacking --- test/bytecode_3.6/03_async_from_coroutine.pyc | Bin 1238 -> 1791 bytes test/bytecode_3.7/03_async_from_coroutine.pyc | Bin 0 -> 1761 bytes test/bytecode_3.8/03_async_from_coroutine.pyc | Bin 0 -> 1626 bytes .../bug36/03_async_from_coroutine.py | 9 +++++++++ uncompyle6/parsers/parse36.py | 8 +++++--- uncompyle6/semantics/gencomp.py | 2 +- uncompyle6/semantics/n_actions.py | 11 +++++++---- 7 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 test/bytecode_3.7/03_async_from_coroutine.pyc create mode 100644 test/bytecode_3.8/03_async_from_coroutine.pyc diff --git a/test/bytecode_3.6/03_async_from_coroutine.pyc b/test/bytecode_3.6/03_async_from_coroutine.pyc index 437a659bd4b53dbb2ba2b7eb5a96859160d80980..da634c61a650bc41f2ecf77b1110f711a0aa4810 100644 GIT binary patch literal 1791 zcmah}Ur!T35Z~Fm9;N)TA}S#o6QAr$L5jqfhA8nte84{>f+pIO?v)hV-gUP%K*|#) z`euxuLcazd!MA($iLbzuzuBXAMF?KAv(vko*_q$`W=j(jxficKZT)hD_#=iM3H>pa zS%gqR(P!~aD5)Imq+FH3E|sT7usbTNMzOmpr^c{n)cCq6OwuR?VvZE8It+44=OwiLce{QR{ zU0Rx(FIB4SR;lZtRjCC!=ye-yzZmYFjFz|kw!a(dWiHBax;e2wt9$JVJ`~H%pjK^~ z?;ZWdn#&>be=ty*NxLpTBJ-yF9Hv3&`M zeflmtZVDkn(OQ8tCsmM|i_|U)Mk`JJBv)=WOt%)a!euVT=07g>Z*fihWeADH(7Gdb zHVI{eS}?K$M}9RxV+?wN2B*TzutZvcvMmm1_u+s@2}|S8kR~vr)IbiK`z~;8PZpvC&@B=oG>qwhxj7u zWZRcLAWKtl9T_z^M#{yZnCffWDrR<3d1+07QOw zI{6fej(eu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^t##5Qqf (3, 2): - code_index = -6 - if self.version > (3, 6): - # Python 3.7+ adds optional "come_froms" at node[0] + if self.version >= (3, 6): if node[0].kind in ("load_closure", "load_genexpr") and self.version >= (3, 8): + code_index = -6 is_lambda = self.is_lambda if node[0].kind == "load_genexpr": self.is_lambda = False self.closure_walk(node, collection_index=4) self.is_lambda = is_lambda else: - code_index = -6 + # Python 3.7+ adds optional "come_froms" at node[0] so count from the end + if node == "generator_exp_async" and self.version[:2] == (3, 6): + code_index = 0 + else: + code_index = -6 iter_index = 4 if self.version < (3, 8) else 3 self.comprehension_walk(node, iter_index=iter_index, code_index=code_index) pass