From 6aa4376fca9d6a975d969390a912874b992db411 Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 7 Jan 2018 08:40:57 -0500 Subject: [PATCH] Fix another 2.5- try/else (in loop) bug --- test/bytecode_2.4_run/02_try_else_loop.pyc | Bin 0 -> 529 bytes test/bytecode_2.4_run/03_try_else.pyc | Bin 0 -> 510 bytes test/stdlib/runtests.sh | 4 ---- uncompyle6/parser.py | 1 + uncompyle6/parsers/parse24.py | 12 +++++++++++- uncompyle6/parsers/parse25.py | 7 ++++++- uncompyle6/scanners/tok.py | 12 ++++++++---- 7 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 test/bytecode_2.4_run/02_try_else_loop.pyc create mode 100644 test/bytecode_2.4_run/03_try_else.pyc diff --git a/test/bytecode_2.4_run/02_try_else_loop.pyc b/test/bytecode_2.4_run/02_try_else_loop.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fcd11b61343dc597fa6c1be81d1685f3e84e8cb2 GIT binary patch literal 529 zcmah`%Sr<=6g`>ggBGj>-{7Jyq_b*E!L^EyWf!ejDag>yq;;g7jL9u@pl+%^;m&XL z3%r?1aU%xq$ssxC27fA(z zatL!)yuWfF{$mVE1X`eM)ZJ%`NOOEoVN+pdXr7CMl8u9}b8`ATDl(uo^kOATt1>uUSsEE9? cw_zPGJJx>DFJ=u{7u^E0>@m)>C<~?SZldzy#YQ5c@re*P$v0w#i#2$GeA}q&gMM8G(xr{mAiZk702xn zObp_a)jT5r-Oq^kFY~4@cL0~2zGep}lCH0MeJ!%=IzySi=H@+bjFo#f*>R(3waC>% z^Dl5q94)FW1Sp0sVt4y6DpjW_OySn}I#7kV&~MsmllyE-dJ_+R6yMMia61fEk0&FQ zT2mH7)qX6W4vyOUhp8*3sTx_eH<`K`w`C@E$~yUWc7p*FQzRC|6mnFjRq}EZDRvh- hh3M)GXV$91{R@&OCsOn>JS6fq{$;?4-yw2W;$N2QQ`G # Copyright (c) 1999 John Aycock @@ -34,14 +34,18 @@ class Token(): self.opc = opc def __eq__(self, o): - """ '==', but it's okay if offsets and linestarts are different""" + """ '==' on kind and "pattr" attributes. + It is okay if offsets and linestarts are different""" if isinstance(o, Token): - # Both are tokens: compare type and attr - # It's okay if offsets are different return (self.kind == o.kind) and (self.pattr == o.pattr) else: + # ?? do we need this? return self.kind == o + def __ne__(self, o): + """ '!=', but it's okay if offsets and linestarts are different""" + return not self.__eq__(o) + def __repr__(self): return str(self.kind)