From 97f48f13221c95b9e6f2c765e7ad8e5c5d068b6d Mon Sep 17 00:00:00 2001 From: rocky Date: Thu, 17 Dec 2015 21:41:47 -0500 Subject: [PATCH] Frank Ebersoll's grammar fix to make "assert isinstance(1, int)" work. --- test/Makefile | 5 +++++ test/bytecode_2.5/README | 1 + test/bytecode_2.6/if.pyc | Bin 0 -> 153 bytes test/bytecode_2.6/ifelse.pyc | Bin 0 -> 177 bytes test/bytecode_2.7/assert.pyc | Bin 0 -> 185 bytes test/bytecode_2.7/assign.pyc | Bin 0 -> 138 bytes test/bytecode_3.4/assign.pyc | Bin 0 -> 128 bytes test/bytecode_3.4/if.pyc | Bin 135 -> 137 bytes test/bytecode_3.4/ifelse.pyc | Bin 153 -> 155 bytes test/bytecompile-tests | 6 ++++-- test/simple-source/misc/assert.py | 5 +++++ test/simple-source/misc/assign.py | 4 ++++ uncompyle6/parsers/parse2.py | 1 - uncompyle6/parsers/parse3.py | 1 - 14 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 test/bytecode_2.5/README create mode 100644 test/bytecode_2.6/if.pyc create mode 100644 test/bytecode_2.6/ifelse.pyc create mode 100644 test/bytecode_2.7/assert.pyc create mode 100644 test/bytecode_2.7/assign.pyc create mode 100644 test/bytecode_3.4/assign.pyc create mode 100644 test/simple-source/misc/assert.py create mode 100644 test/simple-source/misc/assign.py diff --git a/test/Makefile b/test/Makefile index da2ad2aa..0adb1dca 100644 --- a/test/Makefile +++ b/test/Makefile @@ -37,9 +37,14 @@ check-bytecode: check-native-short: $(PYTHON) test_pythonlib.py --bytecode-$(PYTHON_VERSION) --verify $(COMPILE) +#: Short, quickly-running Python 2.7 programs. Useful in debugging grammar problems check-short-2.7: $(PYTHON) test_pythonlib.py --bytecode-2.7 --verify $(COMPILE) +#: Short, quickly-running Python 2.7 programs. Useful in debugging grammar problems +check-short-3.4: + $(PYTHON) test_pythonlib.py --bytecode-3.4 --verify $(COMPILE) + #: Run longer Python 2.7's lib files known to be okay check-2.7-ok: $(PYTHON) test_pythonlib.py --ok-2.7 --verify $(COMPILE) diff --git a/test/bytecode_2.5/README b/test/bytecode_2.5/README new file mode 100644 index 00000000..d2a6510d --- /dev/null +++ b/test/bytecode_2.5/README @@ -0,0 +1 @@ +These are byte-compiled programs compiled by Python 2.5 diff --git a/test/bytecode_2.6/if.pyc b/test/bytecode_2.6/if.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9463674bae2f3a64e3b6485b231d51ae9b601bc8 GIT binary patch literal 153 zcmcckiI;27%c8Jk1}INrk_J$K0YMbY0=dPRxdl0?y2bgWMail9Nkxfy$r+h>>H3*zdIgmw96%K| Tx%nxjIjMFaGmDvk1Un-DpUfMd literal 0 HcmV?d00001 diff --git a/test/bytecode_2.6/ifelse.pyc b/test/bytecode_2.6/ifelse.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7577df401c0721a2724426a25e3a3744ba4a901b GIT binary patch literal 177 zcmcckiI+?1RZ& zp9U+CECDeS!DKR+OahasU@}DmD9L~ziWPy};>_HFoK)T7{L-T2RQ;r)#JuE;%)E5{ i%(T>;;#9qY$`THsDx2K=l+v73I~I@*5W&vK#RLGcydOyb literal 0 HcmV?d00001 diff --git a/test/bytecode_2.7/assert.pyc b/test/bytecode_2.7/assert.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f2630b11db30b3aaf6b672d4dd3028b608cc082e GIT binary patch literal 185 zcmYLAF$w}P5ZvStwI v7;`$8l8cc9{zN;moh6LZ81|Is;)0Dx&JN#NH{E$DFMZ5@9>ZZFI|<+eGvOvB literal 0 HcmV?d00001 diff --git a/test/bytecode_2.7/assign.pyc b/test/bytecode_2.7/assign.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6c0ebc5cca5ee152eba05cd04dbdedf695f8f876 GIT binary patch literal 138 zcmZSn%*%B%w>T`B0SXv_v;zHtYU4Um!&Rv=N9Sd^Ks z0c0>Bh+;V)S5LnZq0fq~&M5W@i@kmUfx#auulg@GXoNHQ`6Ycgf(FflOrX);E!mL(Qt z=C5QZ0x1O(zvT4vi!*Zza#D4R^Gl18Q}uH*i<9*ei;FYU^YjWTZ*kb<=BJeAq}s87 IOa@{G03ahAZ~y=R literal 0 HcmV?d00001 diff --git a/test/bytecode_3.4/if.pyc b/test/bytecode_3.4/if.pyc index 896df4002b7f5e0b9a31df89ba37b7d0d3c92f1f..6e346c8ee356d35a39254b7f8cc14a3d5dfea43d 100644 GIT binary patch delta 13 UcmZo?>|~q}!Yr?+KQYt@02z@3jsO4v delta 11 ScmeBVY-gMh!YDg2+z0>@vjZ;x diff --git a/test/bytecode_3.4/ifelse.pyc b/test/bytecode_3.4/ifelse.pyc index 593999eb563c7b3e75734feccf6be4802468c6ac..34195d47c81e0204bd398b1befdf534fa8d5bce0 100644 GIT binary patch delta 13 UcmbQqIGb@o0<*H7{=`HJ02|i>)Bpeg delta 11 ScmbQuIFoTg0;A%@WD5Wlkpp!A diff --git a/test/bytecompile-tests b/test/bytecompile-tests index 67c8800a..3d224d3b 100755 --- a/test/bytecompile-tests +++ b/test/bytecompile-tests @@ -55,8 +55,10 @@ tests['2.3'] = tests['2.2'] tests['2.5'] = tests['2.3'] # tests['2.7'] = ['mine'] + tests['2.6'] tests['2.7'] = [ - 'simple-source/branching/ifelse', - 'simple-source/branching/if' + # 'simple-source/branching/ifelse', + # 'simple-source/branching/if' + 'simple-source/misc/assert', + 'simple-source/misc/assign', # 'simple-source/call_arguments/keyword', # 'simple-source/call_arguments/positional' ] diff --git a/test/simple-source/misc/assert.py b/test/simple-source/misc/assert.py new file mode 100644 index 00000000..92527b02 --- /dev/null +++ b/test/simple-source/misc/assert.py @@ -0,0 +1,5 @@ +# Tests: +# assert ::= assert_expr jmp_true LOAD_ASSERT RAISE_VARARGS_1 +# callfunction ::= ... + +assert isinstance(1, int) diff --git a/test/simple-source/misc/assign.py b/test/simple-source/misc/assign.py new file mode 100644 index 00000000..13bd4414 --- /dev/null +++ b/test/simple-source/misc/assign.py @@ -0,0 +1,4 @@ +# Tests: +# assign ::= expr designator + +vario = 556 diff --git a/uncompyle6/parsers/parse2.py b/uncompyle6/parsers/parse2.py index 4fef71f5..8922aa5e 100644 --- a/uncompyle6/parsers/parse2.py +++ b/uncompyle6/parsers/parse2.py @@ -505,7 +505,6 @@ class Python2Parser(PythonParser): expr ::= LOAD_FAST expr ::= LOAD_NAME expr ::= LOAD_CONST - expr ::= LOAD_ASSERT expr ::= LOAD_GLOBAL expr ::= LOAD_DEREF expr ::= LOAD_LOCALS diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index 177e0572..9b26ab21 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -505,7 +505,6 @@ class Python3Parser(PythonParser): expr ::= LOAD_FAST expr ::= LOAD_NAME expr ::= LOAD_CONST - expr ::= LOAD_ASSERT expr ::= LOAD_GLOBAL expr ::= LOAD_DEREF expr ::= LOAD_LOCALS