From 1419acf019458d53a6c7cf2be266d92115678ddf Mon Sep 17 00:00:00 2001 From: rocky Date: Mon, 11 Nov 2019 13:50:48 -0500 Subject: [PATCH] More Python 3.0 for JUMP elimination ... here, in except blocks. --- test/bytecode_3.0/02_try_except_except.pyc | Bin 409 -> 655 bytes .../simple_source/bug30/02_try_except_except.py | 10 ++++++++++ uncompyle6/parsers/parse30.py | 3 +++ 3 files changed, 13 insertions(+) diff --git a/test/bytecode_3.0/02_try_except_except.pyc b/test/bytecode_3.0/02_try_except_except.pyc index 2d6554652bdb39ff9572d2d1ba7743f176145139..a56e00218c251242dbbb5bb745eb9be5138518c6 100644 GIT binary patch delta 269 zcmYjMK??z45Pf5jK5RKSIJ#|aN-h$`MM}v5TMpPgY+_lv#X&Cal9M0dhxkFxyf2ZN z<~7Zm_vZU<#yL^1WwNSze@y21ix~SRYg-_AfCHQaHXFeSumw&G1IxHnp2we1xSL|N zw6ILrm9SS@asY-K1Mv`8DEKCXK?lyqoXd#76Evi%=V>Dz1uWe~IYQUn&-`iNbXK7o z1kpPDP;nrEr60K0jx>s%Ca3ezq+qKE5QC}2l%A!(ba~~ok$&QL^V*hvQZt$K8yB)G Ay8r+H delta 105 zcmeBYoylxs&BM#3a8x%snE?qf0oe{fTr2=2G8q_B7#La@8KQs;MuuPwrir#+75p?9 nfpVoF1;r(aMJ4fhspat{8AYjyDH=dAhKc8_Cs!~DvVhnCbq*6( diff --git a/test/simple_source/bug30/02_try_except_except.py b/test/simple_source/bug30/02_try_except_except.py index 56c729a9..3bbc94e7 100644 --- a/test/simple_source/bug30/02_try_except_except.py +++ b/test/simple_source/bug30/02_try_except_except.py @@ -7,3 +7,13 @@ def start_new_thread(function, args, kwargs={}): pass except: args() + +# Adapted from 3.0.1 code.py +# Bug is again JUMP_FORWARD elimination compared +# to earlier and later Pythons. +def interact(): + while 1: + try: + more = 1 + except KeyboardInterrupt: + more = 0 diff --git a/uncompyle6/parsers/parse30.py b/uncompyle6/parsers/parse30.py index f5e07b95..470fbe3d 100644 --- a/uncompyle6/parsers/parse30.py +++ b/uncompyle6/parsers/parse30.py @@ -121,6 +121,9 @@ class Python30Parser(Python31Parser): gen_comp_body ::= expr YIELD_VALUE COME_FROM POP_TOP + except_handler ::= jmp_abs COME_FROM_EXCEPT except_stmts + COME_FROM POP_TOP END_FINALLY + ################################################################################ for_block ::= l_stmts_opt _come_froms POP_TOP JUMP_BACK