Compare commits

...

230 Commits

Author SHA1 Message Date
rocky
5489ee9857 Merge branch 'master' into python-2.4 2020-01-26 12:15:10 -05:00
rocky
7fc4ccf75a Get ready for release 3.6.3 2020-01-26 12:11:22 -05:00
rocky
f8c437230d Get ready for release 3.6.3 2020-01-26 12:08:40 -05:00
rocky
e30051b460 Merge branch 'master' into python-2.4 2020-01-26 12:00:11 -05:00
rocky
dff3611d16 Tidy runtests.sh more. 2020-01-26 11:52:35 -05:00
rocky
13ca1117ad 3.x "if" in loop grammar separation 2020-01-26 10:32:29 -05:00
rocky
e80e72e6ab ifelsestmt transform must object types more 2020-01-26 10:12:26 -05:00
rocky
b893a9ae21 exclusions again 2020-01-26 09:38:21 -05:00
rocky
24657961d6 exclusions again 2020-01-26 09:33:29 -05:00
rocky
71e9b0d96d More "if" in loop parse separation 2020-01-26 09:25:04 -05:00
rocky
466b894ed4 3.4 exclusions 2020-01-26 08:35:02 -05:00
rocky
1fff81736f parser if-stmt restriction thing & 3.x exclusions 2020-01-26 08:27:49 -05:00
rocky
49df216c67 Need to exclude fstring test 2020-01-26 03:54:55 -05:00
rocky
118e21b2cd A recent changed bolixed docstrings...
fixa
2020-01-26 03:30:57 -05:00
rocky
ba47a8d009 Runtest 3.6 exclusions 2020-01-26 03:03:59 -05:00
rocky
33918bd9d2 More 3.x "if" checking. Abbreviate stmts->sstmt 2020-01-26 02:58:33 -05:00
rocky
7721fbd276 runtest exclusions for POWER (again) 2020-01-26 01:43:21 -05:00
rocky
b5a5a128b5 Runtest exclusion for POWER 2020-01-26 00:23:22 -05:00
rocky
64100bd0c9 Runtest exclusions 2020-01-26 00:11:29 -05:00
rocky
1c172f3962 runtest exclusions 2020-01-25 23:10:27 -05:00
rocky
382a3b1483 3.5 exclusions 2020-01-25 22:26:28 -05:00
rocky
584d663394 runtest exclusions 2020-01-25 22:09:57 -05:00
rocky
a02f490889 Restrict more runtests for now...
Sigh. Forward leaps followed by backward steps. Repeat
2020-01-25 20:59:56 -05:00
rocky
d43972313a Cut-n-paste grammar rule bug 2020-01-25 19:06:41 -05:00
rocky
dac277f1fa Back off loop separate rules, a little for now 2020-01-25 18:07:05 -05:00
rocky
a50263518a 3.x if loop separation 2020-01-25 17:32:28 -05:00
rocky
73fb9f6b96 Make sure "stmts" stays the start rule 2020-01-25 16:14:36 -05:00
rocky
c772972227 Exclusions again. 2020-01-25 13:28:48 -05:00
rocky
f3228162dd scale back on tests until grammar refactor done...
and that will come in the next release
2020-01-25 12:45:01 -05:00
rocky
66b3e35a5b 3.+ More loop-isolation grammar separation...
but also back off some isolation separation for now.
2020-01-25 11:46:03 -05:00
rocky
58f2e19539 Hack around grammar weakness in 3.5..3.6 for now 2020-01-25 10:12:18 -05:00
rocky
f6f2d8dd05 Start to disambiguate stmts in a loop 2020-01-25 09:14:55 -05:00
rocky
13b1ec7ad8 Better "ifstmt" reduction rule and ...
Tidy 3.7 grammar a little
Disable a number of 3.0 bytecode for now. Will Go over later.
2020-01-25 00:04:37 -05:00
rocky
c90ff5176c Add 3.x try reduction rule 2020-01-24 20:48:04 -05:00
rocky
72b053acef Update 2.6 exclusions for runtests 2020-01-24 07:52:24 -05:00
rocky
09195c09fd Go over 3.5.9 runtests.sh 2020-01-24 07:08:37 -05:00
rocky
10695d882e Fix bug in 3.7 chained comparison semantic action 2020-01-24 06:14:28 -05:00
rocky
5c31fdc362 Fix bug in 3.6 handling kwonly params ...
when there are annotation args
2020-01-24 05:47:41 -05:00
rocky
5616f56442 Remove unreachable code from make_function36.py...
with respect to picking out MAKE_FUNCTION attributes.

Fill in runtests.sh exclude lists
2020-01-24 05:05:56 -05:00
rocky
dab7915404 Go over runtests 3.7 excludes 2020-01-24 03:49:12 -05:00
rocky
4067a30573 Fix bug introduced by a recent refactoring 2020-01-24 03:11:51 -05:00
rocky
7e91daf043 3.7 "if" body tweak . 2020-01-23 21:38:47 -05:00
rocky
e76e9b7ab6 ifelsestmt reduce check tracking parse rule change 2020-01-23 20:04:53 -05:00
rocky
1b96402732 More 3.4-3.6 runtest.sh test work now...
Seems to have been the recent fix which limit while1stmt
matching
2020-01-23 15:26:02 -05:00
rocky
0421863cd3 I said 3.4 compatibility! 2020-01-23 13:58:50 -05:00
rocky
e0f5cb2bd2 3.4- compliance 2020-01-23 13:51:46 -05:00
rocky
28a80a0132 3.6+ extended arg handling; sync with decompyle3..
Use 3.8 scanner now.

TODO: Need to investigate what's up with 3.7/01_extended_arg.py
2020-01-23 13:35:22 -05:00
rocky
eeb48818f3 Largish rework: scan while1stmt for jump out ..
to disambiguate.

For this, we use the self.opc JUMP_OPS sets.
For this, we neeed to store opc in the parse object.

DRY uses of "last = min(last, len(tokens))
2020-01-23 13:02:29 -05:00
rocky
0f4b791502 Exclue 3.7 test_binascii.py for now 2020-01-23 11:44:31 -05:00
rocky
96c9058cc1 Mini-sync with decompyle3:
go over runtests.sh 3.8 excludes
2020-01-23 07:00:53 -05:00
rocky
5951f974d5 Fix 3.8 grammar rule bug: "for" with "if"/"return" 2020-01-23 06:07:34 -05:00
rocky
29715bb8bf 3.8 ifelsestmt grammar rule...
and remove optional "c_stmts" in 3.7 "ifelsesmt" rule. We may
have to come back and add something, but when we do we'll be more
careful and this is probably all for the better.
2020-01-22 22:50:27 -05:00
rocky
31481de209 Test for previous commit 2020-01-22 19:24:29 -05:00
rocky
e17d9c806a ifstmt reduction vs extended_args 2020-01-22 19:14:52 -05:00
rocky
c1cde68da8 Change runtests.sh default to stop on 1st error 2020-01-22 14:49:51 -05:00
rocky
018583069b 3.7+ bug in handling extended arg 2020-01-22 14:31:45 -05:00
rocky
dcf7ca1061 Go over runtest exclusions 2020-01-22 07:23:54 -05:00
rocky
ed64e7b443 Check that the jumps to jump fix jumps to a *jump* 2020-01-22 07:07:57 -05:00
rocky
5d64664857 Python 2.6.9 compatibility 2020-01-22 06:27:31 -05:00
rocky
b12893f343 2.4 compatibility 2020-01-22 06:25:58 -05:00
rocky
80b0d4284b Merge branch 'master' into python-2.4 2020-01-22 05:54:20 -05:00
rocky
e07f799cdd 3.7 runtest exclusion update 2020-01-22 05:36:22 -05:00
rocky
bc50825460 Conditional jumps to extended-arg JUMP_BACK...
this is a major reworking. But it leads the way forward to a
simpler grammar.
2020-01-22 05:32:27 -05:00
rocky
c6069eb7f8 Go over 3.7 test exclusions. Some tests now work. 2020-01-21 22:08:57 -05:00
rocky
d2f59189dd Add missing code for n_assert_invert 2020-01-21 21:54:09 -05:00
rocky
03b5fbaeab Split out 2.7 runtest exclusions...
Note why test_compile.py will always fail.
2020-01-21 20:37:42 -05:00
rocky
b91df57a82 Add "ifelsestmt" reduce rule checking 2020-01-21 16:03:12 -05:00
rocky
afedf43ee1 Add "ifelsestmt" reduce rule checking 2020-01-21 16:01:19 -05:00
rocky
8684137f80 Merge branch 'master' into python-2.4 2020-01-21 07:16:36 -05:00
rocky
412a811ddb Go over 2.5 runtest exclusions 2020-01-21 07:15:47 -05:00
rocky
dc16f03f50 Split out 2.5 runtest exclusions to its own file 2020-01-21 07:11:45 -05:00
rocky
2c608c7909 Merge branch 'master' into python-2.4 2020-01-21 06:50:49 -05:00
rocky
73eab178ae Towards syncing with decompyle3 2020-01-21 06:36:54 -05:00
rocky
f4e6382cc1 Specialize "classdef" nonterminal for 3.6+ 2020-01-21 04:56:11 -05:00
rocky
67c37f1a03 blacken yet another buffer 2020-01-21 04:46:04 -05:00
rocky
beac1d3567 Fix a bug in 3.6+ keyword-only argument passing 2020-01-21 04:37:58 -05:00
rocky
e466e826b3 Small bug in 3.6+ in finding class name 2020-01-20 22:43:20 -05:00
rocky
eacc3f5cc7 blacken (reformat) a parser.py 2020-01-18 05:23:16 -05:00
rocky
af7b05922f More exclude 2020-01-17 15:02:54 -05:00
rocky
7a6511307f See above 2020-01-17 14:09:08 -05:00
rocky
26a4577cdb test_tcl.py exclusion for 3.4 2020-01-17 12:44:35 -05:00
rocky
7263b6b15f Go over test exclusions yet again 2020-01-17 12:14:30 -05:00
rocky
e06f0990f8 Go over test data for 3.6 2020-01-17 11:10:14 -05:00
rocky
b333d7afc2 If statement in loop isolation 2020-01-17 10:47:38 -05:00
rocky
4510aa932c Up limits on tests, since we have improved parsing 2020-01-17 06:37:38 -05:00
rocky
d9bc5a345b Don't check iflaststml on 3.2 just yet 2020-01-17 05:42:49 -05:00
rocky
af76218abf More parser changes to reinstate what was working in 3.6.2...
However, again, probably more precise since we isolate loop rules better

However, again, this isnt' the full store. Semantics were incorrect in
Release 3.6.2 and they still are.
2020-01-17 05:36:20 -05:00
rocky
273c4bcbf0 Remove unused rule...
found by test_grammar.py
2020-01-17 05:01:44 -05:00
rocky
7ec1d0e17b Merge branch 'master' of github.com:rocky/python-uncompyle6 2020-01-17 04:44:59 -05:00
rocky
027c9a7dc0 Fix "for ... if" bug introduced since 3.6.2...
However we've isolated and documented the 3.x grammar a little bit better
2020-01-17 04:41:16 -05:00
rocky
6d368d2b30 parens around consts when taking attr again 2020-01-16 22:15:28 -05:00
rocky
549c33113b Exclude recently broken 3.3, and 3.7 tests for now. 2020-01-16 14:12:50 -05:00
rocky
39459168b0 More stringent "ifstmt" checks on 3.x 2020-01-16 14:02:04 -05:00
rocky
a532aa5b0e 3.7+ use attribute_w_parens like we do in pre 3.7 2020-01-16 11:43:29 -05:00
rocky
bad40eb63f Disable 3.6 test_sys.py until we can fix 2020-01-16 04:48:54 -05:00
rocky
172239f50b More accurate 3.6 "ifsmt" and "ifelsesmt" 2020-01-16 04:11:12 -05:00
rocky
e0f0741c8e Go over 2.6.9 runtests.sh 2020-01-15 21:49:22 -05:00
rocky
af1fe8f176 3.7 and 2.6 coexistance in handling jump targets 2020-01-15 21:38:53 -05:00
rocky
0677ddc8fb Constrain ifelsestmt on 2.6 more. 2020-01-15 21:32:39 -05:00
rocky
3fbe0b90e3 Fix typo bug introduced in refactoring. 2020-01-15 19:47:03 -05:00
rocky
546269271f go over POWER exclusion tests 2020-01-15 04:54:41 -05:00
rocky
968f86011b 3.6+ if/else in loops where jump offsets are "large" 2020-01-15 04:43:53 -05:00
rocky
5cdf057a47 Correct handling "if" in dictcomp in semantic actions for 3.x 2020-01-15 02:36:19 -05:00
rocky
3c2dafe74c Fix a 2.6 bug found in pyenvlib testing 2020-01-14 22:30:48 -05:00
rocky
585dcfb8ce Start allowing runtests for 3.7.x 2020-01-14 19:16:19 -05:00
rocky
84e9b75e78 Attempt to fix runtests.sh again 2020-01-14 18:51:40 -05:00
rocky
5f230fa177 Add 3.7 "testfalsel" for looping conditions 2020-01-14 18:41:39 -05:00
rocky
e2cbf5f4bd small tweak to last change 2020-01-14 13:03:24 -05:00
rocky
bb8c5ac5a0 Sync 3.7+ n_call code with decompyle6 2020-01-14 12:45:02 -05:00
rocky
cbd45a93ab Warn about byte type when decompiling Python3 from Python2 2020-01-14 12:07:42 -05:00
rocky
0706f18b1d 3.7 test_fstring now works. 2020-01-14 00:09:04 -05:00
rocky
73937ffeb4 Handle set/dictionary comprehensions in format strings 2020-01-13 23:49:17 -05:00
rocky
a918055a31 3.6+ nested format strings again 2020-01-13 21:25:20 -05:00
rocky
ec3a9978fc Better 3.6+ nested format strings 2020-01-13 19:08:54 -05:00
rocky
491f81902d File typo 2020-01-13 16:30:34 -05:00
rocky
0a63a66f55 runtests.sh remove 2.6.9 "fails on its own" tests 2020-01-13 16:02:05 -05:00
rocky
3540c951dc Merge branch 'master' into python-2.4 2020-01-13 12:56:51 -05:00
rocky
b8413d2c23 runtests 2.6 typo 2020-01-13 12:56:25 -05:00
rocky
4b46a8ffdf Small fixes 2020-01-13 11:41:53 -05:00
rocky
74961caed1 Merge branch 'master' into python-2.4 2020-01-13 11:25:59 -05:00
rocky
84fe813f0a Typo in last commit 2020-01-13 11:23:34 -05:00
rocky
7f2f3bd76c runtest.sh 2.6.9 exclusion tweak 2020-01-13 10:31:03 -05:00
rocky
c046aa3b9b runtest 3.6 tweak 2020-01-13 09:46:32 -05:00
rocky
d575e57e31 Runtests for 2.6 go tweak 2020-01-13 09:43:34 -05:00
rocky
02e0377ce1 Separate 2.6 files in runtests.sh 2020-01-13 09:31:39 -05:00
rocky
a5c987d853 See above 2020-01-13 09:16:08 -05:00
rocky
cbd8b6d458 Start clean up runtest.sh exclusions 2020-01-13 09:11:22 -05:00
rocky
54f4806021 More fstring bugs -- nested fstring grammar rules 2020-01-13 08:04:53 -05:00
rocky
de282af05d Fix some fstring formats bugs...
* Need parens around a lambda in an format string.
* handle format string specifier + width

Note: other format-string bugs remain.
2020-01-13 06:40:18 -05:00
rocky
f56ad56021 Wacky string at beginning of fn which is not docstring...
3.7.6 test_fstring.py tests this.
2020-01-12 22:59:06 -05:00
rocky
359672415b Merge branch 'master' into python-2.4 2020-01-12 22:04:14 -05:00
rocky
d8990c89ae Merge branch 'master' of github.com:rocky/python-uncompyle6 2020-01-12 22:03:55 -05:00
rocky
fe9a8c9dfe Go over 3.7 test failurs in runtests.sh 2020-01-12 22:03:47 -05:00
rocky
540fde898d See above 2020-01-12 12:43:48 -05:00
rocky
fd35f045b7 runtests again 2020-01-12 11:51:04 -05:00
rocky
4f0e8d8ab4 Runtests again 2020-01-12 11:38:15 -05:00
rocky
5b889bf4f3 Fix test_grammar.py for 2.4 2020-01-12 11:28:37 -05:00
rocky
7adfc9c2dc Merge branch 'master' into python-2.4 2020-01-12 10:23:52 -05:00
rocky
58d8e29905 runtests.sh again 2020-01-12 10:11:12 -05:00
rocky
b61170657c runtests again 2020-01-12 08:22:10 -05:00
rocky
2f1802873a Add timeout to runtests.sh 2020-01-12 07:28:13 -05:00
rocky
9f6138ccc0 See above 2020-01-12 06:18:32 -05:00
rocky
a4e114f64f runtests again. 2020-01-12 05:34:16 -05:00
rocky
52c5d07d95 Update runtests.sh 2020-01-12 05:17:46 -05:00
rocky
ac0b0ff7b6 DRY Python 2 reduction check code a little 2020-01-12 04:50:45 -05:00
rocky
316bf7f0e0 Go over runtests.sh again 2020-01-12 04:24:55 -05:00
rocky
258db3da20 Go over runtests.sh for a batch environments 2020-01-11 23:12:56 -05:00
rocky
8fda09459c tryelsestmtl3 needs more checks 2020-01-11 22:50:18 -05:00
rocky
021c5cad2a Ooops - stray debug left in 2020-01-11 22:37:40 -05:00
rocky
b84c89e817 Bang on getting 3.x "try" vs "try/else" disambiguated 2020-01-11 22:36:07 -05:00
rocky
aaba4ecb2b Better try/else/finally for 3.x 2020-01-11 21:33:22 -05:00
rocky
aaf8729772 See above 2020-01-11 20:48:28 -05:00
rocky
322c0f67bc One more 3.4 runtest exclusion for now 2020-01-11 20:18:16 -05:00
rocky
9c45794144 Update runtest stats 2020-01-11 20:04:16 -05:00
rocky
e6bade66c0 Typo in last commit 2020-01-11 19:33:40 -05:00
rocky
ccb8b81cc0 Go over runtests.sh for 3.5 again 2020-01-11 19:03:40 -05:00
rocky
56ec47f7ad Rutests.sh update for 3.5 2020-01-11 18:38:51 -05:00
rocky
651170db9a Revise run-and-email scripts. 2020-01-11 18:15:43 -05:00
rocky
9eda8926a3 Go over 3.4 runtest.sh failure list 2020-01-11 17:55:50 -05:00
rocky
89e7eaf695 Go over 3.3 runtests.sh 2020-01-11 12:28:31 -05:00
rocky
b1101311f0 go over 3.4 runtests.sh failure list 2020-01-11 12:05:06 -05:00
rocky
2949b55163 Update runtests for early 3.x 2020-01-11 11:26:30 -05:00
rocky
0ece75f8ae test_ast.py for 3.0..3.3 works now 2020-01-11 11:12:40 -05:00
rocky
7af6b6bc06 Fix 3.0..3.3 keyword-only parameters semantic actions 2020-01-11 11:06:59 -05:00
rocky
ff92ca8586 Update batch test limits...
for the code we have, not the code we would like to have
2020-01-11 10:44:09 -05:00
rocky
061da83863 3.7 "import" fix 2020-01-11 07:37:28 -05:00
rocky
c3d7ba6dad 3.7 "imports" and "or" 2020-01-11 07:23:23 -05:00
rocky
6cef42f6c7 3.7+ "or" disambiguation and assert2 handling 2020-01-10 20:44:28 -05:00
rocky
eba8f04e29 DRY reducecheck code 2020-01-10 15:36:24 -05:00
rocky
d1bc30e2f1 3.7 testtrue with asserts 2020-01-10 14:04:47 -05:00
rocky
fd2b551661 Forgot to add testtrue check 2020-01-10 10:29:24 -05:00
rocky
505946d747 Add "testtrue" reduction rule...
only for 3.7 for now.
2020-01-10 10:26:40 -05:00
rocky
07f16fa040 need to relax node checking on tryelsesmtl3...
now that except_handler_else is derived from except_handler.
2020-01-09 23:24:42 -05:00
rocky
5a3aaa9688 test_grammar again 2020-01-09 23:19:20 -05:00
rocky
69105825bd Administrivia: adjust python grammar check 2020-01-09 23:00:49 -05:00
rocky
ef437d191d 3.5 test_buffer now works 2020-01-09 22:39:35 -05:00
rocky
fedd5e0ba5 Better "try" vs. "try"/"else" disambiguation ...
via reduction check that was originally only in 2.7
2020-01-09 22:37:02 -05:00
rocky
7bcebf8656 Move some parse2 reduction rules into reducecheck 2020-01-09 21:24:04 -05:00
rocky
8b74d8f855 Fix bug in handling 3.5- complex annotation return...
Go over runtests.sh for 3.5
2020-01-09 19:55:22 -05:00
rocky
fee02e0aa0 Go over runtests.sh for 3.5 2020-01-09 18:56:10 -05:00
rocky
a99a4cead4 Go over runtests.sh for 3.6 2020-01-09 17:30:26 -05:00
rocky
d31478f56a Go over 3.6 runtest exceptions 2020-01-09 17:17:55 -05:00
rocky
788cd8dc80 Merge hell 2020-01-09 15:19:37 -05:00
rocky
508331e743 Merge hell 2020-01-09 15:19:00 -05:00
rocky
68c82f9d4e Merge branch 'master' of github.com:rocky/python-uncompyle6 2020-01-09 14:28:57 -05:00
rocky
e0e4aed591 More runtest exclusions 2020-01-09 14:28:35 -05:00
rocky
158b145394 Make runtests.sh more version robust 2020-01-09 12:58:27 -05:00
rocky
d1d9219d48 runtest exclusions 2020-01-09 09:16:03 -05:00
rocky
778c8d6003 Forgot to add this file. 2020-01-09 04:39:27 -05:00
rocky
5fc54015e4 3.7+ or reduction rule again 2020-01-09 04:32:15 -05:00
rocky
14f889561b 3.7+ multiple "and" parser generalize 2020-01-09 03:37:17 -05:00
rocky
7dee584a46 3.7+ "or" handling in listcomp 2020-01-09 03:15:30 -05:00
rocky
7c03cc466d More 2.7 compatibility 2020-01-09 01:35:50 -05:00
rocky
086ceaf176 More 2.7 compatibility 2020-01-09 01:34:41 -05:00
rocky
30d8830957 Fix 2.x compatibility 2020-01-09 01:32:15 -05:00
rocky
199fb532bf Move code from parse37base to reducechecks 2020-01-08 22:24:41 -05:00
rocky
b0d931b760 Small changes 2020-01-08 20:43:32 -05:00
rocky
6f6ef19e0a Start splitting out reduction checks 2020-01-08 20:25:59 -05:00
rocky
7b76d55e55 Start to fold in 3.7 reduction-rule goodness into 3.6 2020-01-08 19:50:05 -05:00
rocky
7d24910b3c "with .. as" with tuples need parens in 3.0 so always add (). 2020-01-08 12:02:34 -05:00
rocky
a98bc444f7 Remove long suffix "L" on ints in bytecode for > 3.0 2020-01-08 11:54:45 -05:00
rocky
13d9bcaaa9 Some reorg and Lame attempt to disasmbiguate "and" and "if .. if"...
More work is needed.
2020-01-08 10:31:19 -05:00
rocky
24f59546fe better output in batch testing 2020-01-07 21:14:35 -05:00
rocky
d8628e79fb 2.6 "if" vs "if/else" disambiguation via reduction rule. 2020-01-07 20:51:44 -05:00
rocky
c0a907f436 Variable name typo in run-and-email.sh 2020-01-07 18:13:30 -05:00
rocky
8afd9cdaf5 Limit run-and-email.sh for now 2020-01-07 15:57:48 -05:00
rocky
c65e5cde70 One more use of except_handler_else 2020-01-07 12:25:00 -05:00
rocky
95bc0f1fbc Update batch runtests.sh 2020-01-07 10:49:14 -05:00
rocky
eb3dac062d More Administrivia 2020-01-07 10:13:25 -05:00
rocky
65e3e5fe5b Update runtests.sh again 2020-01-07 06:25:49 -05:00
rocky
8c5873333f Reduce exceptions in runtest.sh for 2.7 2020-01-07 04:49:04 -05:00
rocky
9a77dfaf95 Use copysign() in 2.6 nuke -0.0 test if < 2.6 2020-01-07 04:39:34 -05:00
rocky
773bbdab0a Use copysign in 2.6 nuke -0.0 test if < 2.6 2020-01-07 04:37:28 -05:00
rocky
14468fe8c9 Go over 2.5 for reduction rules and tests 2020-01-06 23:34:18 -05:00
rocky
9df8dd7384 Go over 2.5 for reduction rules and tests 2020-01-06 23:32:36 -05:00
rocky
ae148d57e5 Merge branch 'master' into python-2.4 2020-01-06 23:32:31 -05:00
rocky
19cac525ee Accomodate "return" in an except handler 2020-01-06 18:57:05 -05:00
rocky
8e2c290e96 Disambiguate 2.7 "try" and "try/else"
will expand to other 2.x versions later
2020-01-06 18:29:10 -05:00
rocky
a3beccc874 Another case where we need code to set the generator bit..
via a dead-code "yield".
2020-01-06 17:22:50 -05:00
rocky
839eb6fe0b bogus "yield" insertion not needed in 2.x 2020-01-06 15:02:40 -05:00
rocky
078cca335a Seomtiems we need to add "yield"...
in order to get the generator bit flag set, such as in 3.x where the
yield is optimized away.
2020-01-06 14:57:11 -05:00
rocky
63a88b8eea Some Python 3.x lambda params are in reverse order 2020-01-06 10:54:14 -05:00
rocky
67c047df75 Python 2.4- doesn't have condition expresions 2020-01-06 04:43:52 -05:00
rocky
78c4db722a Python 2.4- doesn't have condition expresions 2020-01-06 04:42:23 -05:00
rocky
444bab760b Update runtests.sh exception list 2020-01-05 21:25:34 -05:00
rocky
eefe7bdb6b runtests.sh update 2020-01-05 21:24:21 -05:00
rocky
2e0c0f8245 What's up with test_generators.py 2020-01-05 21:17:28 -05:00
rocky
3c5ad58e25 Add 2.x if vs if/else reduction rule check 2020-01-05 21:07:24 -05:00
rocky
e07e2a498e 2.x if vs ifelse reduction-rule testing 2020-01-05 21:04:42 -05:00
rocky
962c503133 Small typo 2020-01-05 18:57:04 -05:00
142 changed files with 3854 additions and 1346 deletions

27
NEWS.md
View File

@@ -1,3 +1,30 @@
3.6.3: 2020-1-26 Martin and Susanne
===================================
Of late, every release fixes major gaps and embarrassments of the last release....
And in some cases, like this one, exposes lacuna and rot.
I now have [control] flow under control, even if it isn't the most optimal way.
I now have greatly expanded automated testing.
On the most recent Python versions I regularly decompile thousands of Python programs that are distributed with Python. when it is possible, I then decompile Python's standard test suite distributed with Python and run the decompiled source code which basically checks itself. This amounts to about 250 test programs per version. This is in addition to the 3 CI testing services which do different things.
Does this mean the decompiler works perfectly? No. There are still a dozen or so failing programs, although the actual number of bugs is probably smaller though.
However, in perparation of a more major refactoring of the parser grammar, this release was born.
In many cases, decompilation is better. But there are some cases where decompilation has gotten worse. For lack of time (and interest) 3.0 bytecode suffered a hit. Possibly some code in the 3.x range did too. In time and with cleaner refactored code, this will come back.
Commit c90ff51 was a local maxiumum before, I started reworking the grammar to separate productions that were specific to loops versus those that are not in loops.
In the middle of that I added another grammar simplication to remove singleton productions of the form `sstmts-> stmts`. These were always was a bit ugly, and complicated output.
At any rate if decompilation fails, you can try c90ff51. Or another decompiler. `unpyc37` is pretty good for 3.7. wibiti `uncompyle2` is great for 2.7. `pycdc` is mediocre for Python before 3.5 or so, and not that good for the most recent Python. Geerally these programs will give some sort of answer even if it isn't correct.
decompyle3 isn't that good for 3.7 and worse for 3.8, but right now it does things no other Python decompiler like `unpyc37` or `pycdc` does. For example, `decompyle3` handles variable annotations. As always, the issue trackers for the various programs will give you a sense for what needs to be done. For now, I've given up on reporting issues in the other decompilers because there are already enough issues reported, and they are just not getting fixed anyway.
3.6.2: 2020-1-5 Samish
======================

View File

@@ -231,7 +231,7 @@ See Also
* https://github.com/rocky/python-xdis : Cross Python version disassembler
* https://github.com/rocky/python-xasm : Cross Python version assembler
* https://github.com/rocky/python-uncompyle6/wiki : Wiki Documents which describe the code and aspects of it in more detail
* https://github.com/zrax/pycdc : The README for this C++ code syas it aims to support all versions of Python. It is best for Python versions around 2.7 and 3.3 when the code was initially developed. Accuracy for current versions of Python3 and early versions of Python is lacking. Without major effort, it is unlikely it can be made to support current Python 3. See its `issue tracker <https://github.com/zrax/pycdc/issues>`_ for details. Currently lightly maintained.
* https://github.com/zrax/pycdc : The README for this C++ code says it aims to support all versions of Python. It is best for Python versions around 2.7 and 3.3 when the code was initially developed. Accuracy for current versions of Python3 and early versions of Python is lacking. Without major effort, it is unlikely it can be made to support current Python 3. See its `issue tracker <https://github.com/zrax/pycdc/issues>`_ for details. Currently lightly maintained.
.. _trepan: https://pypi.python.org/pypi/trepan2g

View File

@@ -1,4 +1,4 @@
# Copyright (C) 2018 Rocky Bernstein <rocky@gnu.org>
# Copyright (C) 2018, 2020 Rocky Bernstein <rocky@gnu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@
# Things that change more often go here.
copyright = """
Copyright (C) 2015-2019 Rocky Bernstein <rb@dustyfeet.com>.
Copyright (C) 2015-2020 Rocky Bernstein <rb@dustyfeet.com>.
"""
classifiers = ["Development Status :: 5 - Production/Stable",

View File

@@ -8,4 +8,15 @@ They are customized to my environment:
- I have git repos for xdis, and spark parser at the same level as uncompyle6
There may be other rocky-specific things that need customization.
how-to-make-a-release.txt has overall how I make a release
how-to-make-a-release.md has overall how I make a release
Since this project uses python over a wide variety of release, some versions
of projects that should be used for specific Python versions
for 3.2.6:
pytest==2.9.2
for 3.1.5
pytset==2.1.0
py=1.8.0 and comment out line 10 of _builtin.py # callable = callable
six==1.10.0

View File

@@ -5,4 +5,4 @@ if [[ $0 == ${BASH_SOURCE[0]} ]] ; then
echo "This script should be *sourced* rather than run directly through bash"
exit 1
fi
export PYVERSIONS='3.5.9 3.6.9 2.6.9 3.3.7 2.7.17 3.2.6 3.1.5 3.4.8 3.7.6 3.8.1'
export PYVERSIONS='3.5.9 3.6.10 2.6.9 3.3.7 2.7.17 3.2.6 3.1.5 3.4.10 3.7.6 3.8.1'

View File

@@ -1,5 +1,5 @@
#!/bin/bash
PYTHON_VERSION=3.7.5
PYTHON_VERSION=3.7.6
# FIXME put some of the below in a common routine
function finish {

View File

@@ -15,3 +15,4 @@ cd $fulldir/..
git checkout python-2.4 && pyenv local $PYTHON_VERSION && git pull
cd $owd
rm -v */.python-version || true
pyenv local $PYTHON_VERSION

View File

@@ -27,6 +27,9 @@ def test_grammar():
expect_lhs.add("attribute")
expect_lhs.add("get_iter")
if PYTHON_VERSION > 3.7 or PYTHON_VERSION < 3.0:
expect_lhs.add("stmts_opt")
else:
expect_lhs.add("async_with_as_stmt")
expect_lhs.add("async_with_stmt")
@@ -42,6 +45,13 @@ def test_grammar():
expect_lhs.add("kvlist")
expect_lhs.add("kv3")
unused_rhs.add("dict")
else:
# NOTE: this may disappear
expect_lhs.add("except_handler_else")
if PYTHON_VERSION < 3.7 and PYTHON_VERSION != 2.7:
# NOTE: this may disappear
expect_lhs.add("except_handler_else")
if PYTHON3:
expect_lhs.add("load_genexpr")

View File

@@ -1,24 +1,25 @@
from uncompyle6 import PYTHON_VERSION
from uncompyle6.scanners.tok import Token
def test_token():
# Test token formatting of: LOAD_CONST None
t = Token('LOAD_CONST', offset=0, attr=None, pattr=None, has_arg=True)
expect = ' 0 LOAD_CONST None'
t = Token("LOAD_CONST", offset=0, attr=None, pattr=None, has_arg=True)
expect = " 0 LOAD_CONST None"
# print(t.format())
assert t
assert t.format() == expect
# Make sure equality testing of tokens ignores offset
t2 = Token('LOAD_CONST', offset=2, attr=None, pattr=None, has_arg=True)
t2 = Token("LOAD_CONST", offset=2, attr=None, pattr=None, has_arg=True)
assert t2 == t
# Make sure formatting of: LOAD_CONST False. We assume False is the 0th index
# of co_consts.
t = Token('LOAD_CONST', offset=1, attr=False, pattr=False, has_arg=True)
expect = ' 1 LOAD_CONST False'
t = Token("LOAD_CONST", offset=1, attr=False, pattr=False, has_arg=True)
expect = " 1 LOAD_CONST False"
assert t.format() == expect
if __name__ == '__main__':
if __name__ == "__main__":
test_token()

View File

@@ -1,12 +1,12 @@
# Python 2.7
# Embedded file name: simple_source/branching/05_if.py
6 0 LOAD_NAME 0 'True'
3 POP_JUMP_IF_FALSE 15 'to 15'
6 0 LOAD_NAME 0 'True'
3 POP_JUMP_IF_FALSE 15 'to 15'
7 6 LOAD_NAME 1 'False'
9 STORE_NAME 2 'b'
12 JUMP_FORWARD 0 'to 15'
15_0 COME_FROM 12 '12'
15 LOAD_CONST None
18 RETURN_VALUE
7 6 LOAD_NAME 1 'False'
9 STORE_NAME 2 'b'
12 JUMP_FORWARD 0 'to 15'
15_0 COME_FROM 12 '12'
15 LOAD_CONST None
18 RETURN_VALUE

View File

@@ -1,15 +1,15 @@
# Python 2.7
# Embedded file name: simple_source/branching/05_ifelse.py
3 0 LOAD_NAME 0 'True'
3 POP_JUMP_IF_FALSE 15 'to 15'
3 0 LOAD_NAME 0 'True'
3 POP_JUMP_IF_FALSE 15 'to 15'
4 6 LOAD_CONST 1
9 STORE_NAME 1 'b'
12 JUMP_FORWARD 6 'to 21'
4 6 LOAD_CONST 1
9 STORE_NAME 1 'b'
12 JUMP_FORWARD 6 'to 21'
6 15 LOAD_CONST 2
18 STORE_NAME 2 'd'
21_0 COME_FROM 12 '12'
21 LOAD_CONST None
24 RETURN_VALUE
6 15 LOAD_CONST 2
18 STORE_NAME 2 'd'
21_0 COME_FROM 12 '12'
21 LOAD_CONST None
24 RETURN_VALUE

View File

@@ -17,7 +17,7 @@ class TestGrammar(unittest.TestCase):
p = get_python_parser(PYTHON_VERSION, is_pypy=IS_PYPY)
(lhs, rhs, tokens,
right_recursive, dup_rhs) = p.check_sets()
expect_lhs = set(['expr1024', 'pos_arg'])
expect_lhs = set(['pos_arg', 'get_iter', 'attribute'])
unused_rhs = set(['list', 'call', 'mkfunc',
'mklambda',
'unpack',])

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -14,27 +14,47 @@ function displaytime {
printf '%d seconds\n' $S
}
PYVERSION=${PYVERSION:-"3.5.5 2.7.14 3.2.6 3.3.7 3.4.8 2.6.9 3.6.4"}
# PYVERSION=${PYVERSION:-"3.5.5"}
. ../admin-tools/pyenv-newer-versions
USER=${USER:-rocky}
EMAIL=${EMAIL:-rb@dustyfeet.com}
MAX_TESTS=${MAX_TESTS:-800}
typeset -i RUN_STARTTIME=$(date +%s)
for VERSION in $PYVERSION ; do
# PYVERSIONS="3.5.6"
actual_versions=""
for VERSION in $PYVERSIONS ; do
typeset -i rc=0
LOGFILE=/tmp/pyenvlib-$VERSION-$$.log
if [[ $VERSION == '3.5.5' ]] ; then
MAX_TESTS=224
elif [[ $VERSION == '3.2.6' ]] ; then
MAX_TESTS=700
elif [[ $VERSION == '3.6.4' ]] ; then
MAX_TESTS=400
else
MAX_TESTS=800
fi
case "$VERSION" in
3.7.6 | 3.8.1 | 3.1.5 | 3.0.1 )
continue
;;
3.5.9 )
MAX_TESTS=900
;;
3.2.6 )
MAX_TESTS=900
;;
3.3.7 )
MAX_TESTS=1300 # About 1256 exist
;;
3.4.10 )
MAX_TESTS=800
;;
3.6.10 )
MAX_TESTS=1300 # about 2139 exist
;;
2.6.9 )
MAX_TESTS=1300
;;
* )
MAX_TESTS=800
;;
esac
actual_versions="$actual_versions $VERSION"
if ! pyenv local $VERSION ; then
rc=1
@@ -42,7 +62,9 @@ for VERSION in $PYVERSION ; do
echo Python Version $(pyenv local) > $LOGFILE
echo "" >> $LOGFILE
typeset -i ALL_FILES_STARTTIME=$(date +%s)
python ./test_pyenvlib.py --max ${MAX_TESTS} --syntax-verify --$VERSION >>$LOGFILE 2>&1
cmd="python ./test_pyenvlib.py --max ${MAX_TESTS} --syntax-verify --$VERSION"
echo "$cmd" >>$LOGFILE 2>&1
$cmd >>$LOGFILE 2>&1
rc=$?
echo Python Version $(pyenv local) >> $LOGFILE
@@ -66,4 +88,4 @@ done
typeset -i RUN_ENDTIME=$(date +%s)
(( time_diff = RUN_ENDTIME - RUN_STARTTIME))
elapsed_time=$(displaytime $time_diff)
echo "Run complete $elapsed_time for versions $PYVERSION" | mail -s "pyenv weak verify in $elapsed_time" ${EMAIL}
echo "Run complete $elapsed_time for versions $actual_versions" | mail -s "pyenv weak verify in $elapsed_time" ${EMAIL}

View File

@@ -0,0 +1,52 @@
def foo():
if julian == -1 and week_of_year != -1 and weekday != -1:
first_weekday = datetime_date(year, 1, 1).weekday()
preceeding_days = 7 - first_weekday
if preceeding_days == 7:
preceeding_days = 0
if weekday == 6 and week_of_year_start == 6:
week_of_year -= 1
if weekday == 0 and first_weekday == 0 and week_of_year_start == 6:
week_of_year += 1
if week_of_year == 0:
julian = 1 + weekday - first_weekday
else:
days_to_week = preceeding_days + 7 * (week_of_year - 1)
julian = 1 + days_to_week + weekday
# 2.6 pstats.py
# Bug is handling "for" with "elif" and "and"s.
def eval_print_amount(a, b, c, d, list, msg=0):
if a:
for i in list:
msg = 1
elif b and c:
msg = 2
elif c and d:
msg = 3
return msg
assert eval_print_amount(True, False, False, False, [1]) == 1
assert eval_print_amount(True, False, False, False, []) == 0
assert eval_print_amount(False, True, True, False, []) == 2
assert eval_print_amount(False, False, True, True, []) == 3
assert eval_print_amount(False, False, False, True, []) == 0
# Bug in 2.6 was in including the part at x = value
# at the end asa part of the "else"
def eval_directive(a):
if a:
value = 2
else:
try:
value = 3
except:
pass
x = value
return x
assert eval_directive(True) == 2
assert eval_directive(False) == 3

View File

@@ -23,6 +23,17 @@ def columnize(l):
if not isinstance(l[i], str)]
assert [0, 2] == columnize([1, 'a', 2])
# From 3.7.6 _collections_abc.py
# Bug was handling "or" in listcomp
def count(values, x):
return sum(1 for v in values if v or x)
assert count([2, 2], False) == 2
assert count([], False) == 0
assert count([], True) == 0
assert count([2], True) == 1
assert count([0], False) == 0
# From 3.7 test_generators
# Bug was in handling the way list_if is optimized in 3.7+;
# We need list_if37 and compare_chained37.

View File

@@ -150,3 +150,12 @@ ann2(1)
assert test12(1, 2, 3, name='hi') == (1, (2, 3)), "a, *args, name"
assert test13(1, 2, 3, name='hi') == ((1, 2, 3), 'hi'), "*args, name"
assert test16('localhost', loop=2, limit=3, a='b') == ('localhost', None, 2, 3, {'a': 'b'})
# From test 3.5 test_pydoc.py.
# Bug was in 3.5 and earlier handling of the return type, typing.Tuple[...]
try:
import typing
def foo() -> typing.Iterator[typing.Tuple[int, typing.Any]]:
...
except:
pass

View File

@@ -14,3 +14,23 @@ def _is_valid_netmask(netmask):
# See in 2.6.9 quopri.py ishex():
assert not '0' <= __file__ <= '9' or 'a' <= __file__ <= 'f' or 'A' <= __file__ <= 'F'
# From 3.7 bug-grammar.py
# Bug in 3.7 was handling the last line where compare_chained -> compare_chained37 and
# therefore compare_chained has one child, not two as it normally does.
def test_comparison():
### comparison: expr (comp_op expr)*
### comp_op: '<'|'>'|'=='|'>='|'<='|'!='|'in'|'not' 'in'|'is'|'is' 'not'
if 1: pass
x = (1 == 1)
if 1 == 1: pass
if 1 != 1: pass
if 1 < 1: pass
if 1 > 1: pass
if 1 <= 1: pass
if 1 >= 1: pass
if 1 in (): pass
if 1 not in (): pass
if 1 < 1 > 1 == 1 >= 1 <= 1 != 1 in 1 not in 1 is 1 is not 1: pass

View File

@@ -8,3 +8,33 @@ def init(modules=None):
assert init() == set()
assert init([1, 2, 3]) == set([1, 2, 3])
# From 3.6 sre_parse
# Bug was in handling multple COME_FROMS from nested if's
def _escape(a, b, c, d, e):
if a:
if b:
if c:
if d:
raise
return
if e:
if d:
raise
return
raise
assert _escape(False, True, True, True, True) is None
assert _escape(True, True, True, False, True) is None
assert _escape(True, True, False, False, True) is None
for args in (
(True, True, True, False, True),
(True, False, True, True, True),
(True, False, True, True, False),
):
try:
_escape(*args)
assert False, args
except:
pass

View File

@@ -79,3 +79,7 @@ class ResultMixin(object):
class SplitResult(namedtuple('SplitResult', 'scheme netloc path query fragment'), ResultMixin):
pass
# From 3.3.7 test_long.py
# Bug was that we need parens around first "0"
assert (0).bit_length() == 0

View File

@@ -5,12 +5,15 @@
# RUNNABLE!
import os.path as osp
from sys import path
from sys import platform
from os import sep, name
import collections.abc
assert osp.basename("a") == "a"
assert path
assert isinstance(platform, str)
assert sep
assert name
assert collections.abc
import os.path as path
assert path

View File

@@ -0,0 +1,21 @@
# From 3.7.6 test_buffer.py
# RUNNABLE!
def foo(n):
zero_stride = True if n >= 95 and n & 1 else False
return zero_stride
assert foo(95)
assert not foo(94)
assert not foo(96)
# from test_buffer.py
# Bug was handling "or" inside a conditional
def rslice(a, b):
minlen = 0 if a or b else 1
return minlen
assert rslice(False, False) == 1
assert rslice(False, True) == 0
assert rslice(True, False) == 0
assert rslice(True, True) == 0

View File

@@ -1,2 +1,82 @@
if __file__:
0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0
# From 3.7 test_buffer.py
# Bug is in dealing with EXTENDED_ARG instructions.
# In reduction-rule tests where we are testing the offset,
# getting *which* offset to test against, when there are two
# possible offset, can mess us up.
def five(a):
return 5
def test_ndarray_slice_multidim(a, f, listerr):
for slices in a:
shape_t = 0; shape_t = 1; shape_t = 2; shape_t = 3; shape_t = 4; shape_t = 5; shape_t = 6; shape_t = 7; shape_t = 8; shape_t = 9
shape_t = 0; shape_t = 1; shape_t = 2; shape_t = 3; shape_t = 4; shape_t = 5; shape_t = 6; shape_t = 7; shape_t = 8; shape_t = 9
shape_t = 0; shape_t = 1; shape_t = 2; shape_t = 3; shape_t = 4; shape_t = 5; shape_t = 6; shape_t = 7; shape_t = 8; shape_t = 9
shape_t = 0; shape_t = 1; shape_t = 2; shape_t = 3; shape_t = 4; shape_t = 5; shape_t = 6; shape_t = 7; shape_t = 8; shape_t = 9
shape_t = 0; shape_t = 1; shape_t = 2; shape_t = 3; shape_t = 4; shape_t = 5; shape_t = 6; shape_t = 7; shape_t = 8; shape_t = 9
nderr = None
if nderr or listerr:
return f(5)
else:
return 2
assert test_ndarray_slice_multidim([1], five, False) == 2
assert test_ndarray_slice_multidim([1], five, True) == 5
# From 3.7 test_builtin.py
def test_pow(self, m, a, b, c, f):
shape_t = 0; shape_t = 1; shape_t = 2; shape_t = 3; shape_t = 4; shape_t = 5; shape_t = 6; shape_t = 7; shape_t = 8; shape_t = 9
shape_t = 0; shape_t = 1; shape_t = 2; shape_t = 3; shape_t = 4; shape_t = 5; shape_t = 6; shape_t = 7; shape_t = 8; shape_t = 9
shape_t = 0; shape_t = 1; shape_t = 2; shape_t = 3; shape_t = 4; shape_t = 5; shape_t = 6; shape_t = 7; shape_t = 8; shape_t = 9
shape_t = 0; shape_t = 1; shape_t = 2; shape_t = 3; shape_t = 4; shape_t = 5; shape_t = 6; shape_t = 7; shape_t = 8; shape_t = 9
shape_t = 0; shape_t = 1; shape_t = 2; shape_t = 3; shape_t = 4; shape_t = 5; shape_t = 6; shape_t = 7; shape_t = 8; shape_t = 9
shape_t = 0; shape_t = 1; shape_t = 2; shape_t = 3; shape_t = 4; shape_t = 5; shape_t = 6; shape_t = 7; shape_t = 8; shape_t = 9
shape_t = 0; shape_t = 1; shape_t = 2;
for z in m:
if a or \
b or \
c:
f(TypeError)
else:
x = 2
x = 3
# From 3.7 test_exceptions.py
# Bug is handling extended arg
def testAttributes(exceptionList):
try:
x = 0
except:
pass
for exc in exceptionList:
x = 0; x = 1; x = 2; x = 3; x = 4; x = 5; x = 6; x = 7; x = 8; x = 9;
x = 0; x = 1; x = 2; x = 3; x = 4; x = 5; x = 6; x = 7; x = 8; x = 9;
x = 0; x = 1; x = 2; x = 3; x = 4; x = 5; x = 6; x = 7; x = 8; x = 9;
x = 0; x = 1; x = 2; x = 3; x = 4; x = 5; x = 6; x = 7; x = 8; x = 9;
x = 0; x = 1; x = 2; x = 3; x = 4; x = 5; x = 6; x = 7; x = 8; x = 9;
x = 0; x = 1; x = 2; x = 3; x = 4; x = 5; x = 6; x = 7; x = 8; x = 9;
x = 0
# From test_urllibnet2.py
# Bug was in detecting end of "if" flowing into an extended-arg "for".
def _test_urls(retry, urls):
if retry:
urlopen = 1
for url in urls:
shape_t = 0; shape_t = 1; shape_t = 2; shape_t = 3; shape_t = 4; shape_t = 5; shape_t = 6; shape_t = 7; shape_t = 8; shape_t = 9
shape_t = 0; shape_t = 1; shape_t = 2; shape_t = 3; shape_t = 4; shape_t = 5; shape_t = 6; shape_t = 7; shape_t = 8; shape_t = 9
shape_t = 0; shape_t = 1; shape_t = 2; shape_t = 3; shape_t = 4; shape_t = 5; shape_t = 6; shape_t = 7; shape_t = 8; shape_t = 9
shape_t = 0; shape_t = 1; shape_t = 2; shape_t = 3; shape_t = 4; shape_t = 5; shape_t = 6; shape_t = 7; shape_t = 8; shape_t = 9
shape_t = 0; shape_t = 1; shape_t = 2; shape_t = 3; shape_t = 4; shape_t = 5; shape_t = 6; shape_t = 7; shape_t = 8; shape_t = 9
shape_t = 0; shape_t = 1; shape_t = 2; shape_t = 3; shape_t = 4; shape_t = 5; shape_t = 6; shape_t = 7; shape_t = 8; shape_t = 9
shape_t = 0

View File

@@ -53,3 +53,20 @@ from collections import namedtuple
Point = namedtuple('Point', 'x y')
p = Point(11, 22)
assert p == Point(**dict(x=11, y=22))
# From 3.7 test/test_keywordonlyarg.py
# Bug was in handling {"4":4} as a dictionary needing **
def posonly_sum(pos_arg1, *arg, **kwarg):
return pos_arg1 + sum(arg) + sum(kwarg.values())
assert 1+2+3+4 == posonly_sum(1,*(2,3),**{"4":4})
# From 3.7 test_grammar.py
# Bug was in handling keyword-only parameters when there are annotations.
# The stack order from least- to most-recent is:
# default, keyword, annotation, closure
# This changes in between Python 3.5 and 3.6.
def f(a, b: 1, c: 2, d, e: 3=4, f=5, *g: 6, h: 7, i=8, j: 9=10,
**k: 11) -> 12: pass
assert f.__annotations__ == {'b': 1, 'c': 2, 'e': 3, 'g': 6, 'h': 7, 'j': 9,
'k': 11, 'return': 12}

View File

@@ -67,3 +67,52 @@ def _repr_fn(fields):
fields = ['a', 'b', 'c']
assert _repr_fn(fields) == ['return xx + f"(a={self.a!r}, b={self.b!r}, c={self.c!r})"']
#################################
# From Python 3.7 test_fstring.py
x = 5
assert f'{(lambda y:x*y)("8")!r}' == "'88888'"
assert f'{(lambda y:x*y)("8")!r:10}' == "'88888' "
assert f'{(lambda y:x*y)("8"):10}' == "88888 "
try:
eval("f'{lambda x:x}'")
except SyntaxError:
pass
else:
assert False, "f'{lambda x:x}' should be a syntax error"
(x, y, width) = ("foo", 2, 10)
assert f'x={x*y:{width}}' == 'x=foofoo '
# Why the fact that the distinction of docstring versus stmt is a
# string expression is important academic, but we will decompile an
# equivalent thing. For compatiblity with older Python we'll use "%"
# instead of a format string
def f():
f'''Not a docstring'''
def g():
'''Not a docstring''' \
f''
assert f.__doc__ is None
assert g.__doc__ is None
import decimal
width, precision, value = (10, 4, decimal.Decimal('12.34567'))
# Make sure we don't have additional f'..' inside the format strings below.
assert f'result: {value:{width}.{precision}}' == 'result: 12.35'
assert f'result: {value:{width:0}.{precision:1}}' == 'result: 12.35'
assert f'{2}\t' == '2\t'
# But below we *do* need the additional f".."
assert f'{f"{0}"*3}' == "000"
# We need to make sure we have { {x:... not {{x: ...
# ^
# The former, {{ confuses the format strings so dictionary/set comprehensions
# don't work.
assert f'expr={ {x: y for x, y in [(1, 2), ]}}' == 'expr={1: 2}'

View File

@@ -6,3 +6,13 @@ def test_assert2(c):
raise SyntaxError('Oops')
test_assert2(5)
# Bug is handling "assert" and confusing it with "or".
# It is important that the assert be at the end of the loop.
for x in (2, 4, 6):
assert x == x
# Bug in 3.7 was not having a rule for 2-arg assert.
# 2-arg assert code doesn't match "if not ... raise "
for x in (1, 3, 5):
assert x == x, "foo"

View File

@@ -1,6 +1,8 @@
# from mult_by_const/instruction.py
# Bug in 3.8 was handling no JUMP_BACK in "for" loop. It is
# in the "if" instead
# RUNNABLE!
def instruction_sequence_value(instrs, a, b):
for instr in instrs:
if a:

View File

@@ -3,12 +3,24 @@
#
# This code is RUNNABLE!
def x(s):
return {k: v
for (k, v) in s
if not k.startswith('_')
}
return {k: v for (k, v) in s if not k.startswith("_")}
# Yes, the print() is funny. This is
# to test though a 2-arg assert where
# the 2nd argument is not a string.
assert x((('_foo', None),)) == {}, print("See issue #162")
assert x((("_foo", None),)) == {}, print("See issue #162")
# From 3.7 test_dictcomps.py
assert {k: v for k in range(10) for v in range(10) if k == v} == {
0: 0,
1: 1,
2: 2,
3: 3,
4: 4,
5: 5,
6: 6,
7: 7,
8: 8,
9: 9,
}

View File

@@ -8,8 +8,19 @@
# classdef ::= LOAD_CONST expr mkfunc CALL_FUNCTION_0 BUILD_CLASS store
# mkfunc ::= LOAD_CONST MAKE_FUNCTION_0
# RUNNABLE!
class A:
pass
class B(Exception):
pass
# From 3.x test_descr.py
class MyInt(int):
class MyInt(int):
__slots__ = ()
try:
(1).__class__ = MyInt
assert False, "builtin types don't support __class__ assignment."
except TypeError:
pass

View File

@@ -11,6 +11,7 @@
# 101_0 COME_FROM '50' statement: if name == ...to fictional "end if"
# 101 JUMP_BACK '16' jump as before to loop head
# RUNNABLE!
def _slotnames(cls):
names = []
for c in cls.__mro__:
@@ -21,3 +22,37 @@ def _slotnames(cls):
continue
else:
names.append(name) # 3.2 bug here jumping to outer for
# From 3.2.6 pdb.py
# There is no "come_from" after the "if" since the
# if jumps back to the loop. For this we use
# grammar rule "ifstmtl"
def lasti2lineno(linestarts, a):
for i in linestarts:
if a:
return a
return -1
assert lasti2lineno([], True) == -1
assert lasti2lineno([], False) == -1
assert lasti2lineno([1], False) == -1
assert lasti2lineno([1], True) == 1
# From 3.7 test_builtin.py
# Bug was allowing if condition jump back to the
# "for" loop as an acceptable "ifstmtl" rule.
# RUNNABLE!
def test_pow(m, b, c):
for a in m:
if a or \
b or \
c:
c = 1
return c
assert test_pow([], 2, 3) == 3
assert test_pow([1], 0, 5) == 1
assert test_pow([1], 4, 2) == 1
assert test_pow([0], 0, 0) == 0

View File

@@ -0,0 +1,41 @@
SKIP_TESTS=(
[test_coercion.py]=1
[test_decimal.py]=1
[test_dis.py]=1 # We change line numbers - duh!
[test_file.py]=1 # test assertion failures
[test_generators.py]=1 # Investigate
[test_grammar.py]=1 # Too many stmts. Handle large stmts
[test_grp.py]=1 # Long test - might work Control flow?
[test_macfs.py]=1 # it fails on its own
[test_macostools.py]=1 # it fails on its own
[test_mailbox.py]=1
[test_nis.py]=1 # it fails on its own
[test_normalization.py]=1 # it fails on its own
[test_optparse.py]=1 # it fails on its own
[test_ossaudiodev.py]=1 # it fails on its own
[test_pdb.py]=1 # Line-number specific
[test_pep277.py]=1 # it fails on its own
[test_pep352.py]=1 # Investigate
[test_plistlib.py]=1 # it fails on its own
[test_pwd.py]=1 # Long test - might work? Control flow?
[test_pyclbr.py]=1 # Investigate
[test_rgbimg.py]=1 # it fails on its own
[test_queue.py]=1 # Control flow?
[test_scriptpackages.py]=1 # it fails on its own
[test_socketserver.py]=1 # Too long to run - 42 seconds
[test_sqlite.py]=1 # it fails on its own
[test_startfile.py]=1 # it fails on its own
[test_struct.py]=1 # "if and" confused for if .. assert and
[test_sunaudiodev.py]=1 # it fails on its own
[test_support.py]=1 # it fails on its own
[test_tcl.py=1] # it fails on its own
[test_threading.py]=1 # test takes too long to run: 11 seconds
[test_thread.py]=1 # test takes too long to run: 36 seconds
[test_trace.py]=1 # Line numbers are expected to be different
[test_urllib2net.py]=1 # is interactive?
[test_urllibnet.py]=1 # it fails on its own
[test_winreg.py]=1 # it fails on its own
[test_winsound.py[=1 # it fails on its own
[test_zipfile64.py]=1 # Runs ok but takes 204 seconds
[test_zlib]=1 # fails on its own
)

101
test/stdlib/2.6-exclude.sh Normal file
View File

@@ -0,0 +1,101 @@
SKIP_TESTS=(
[test___all__.py]=1 # it fails on its own
[test___all__.py]=1 # it fails on its own
[test_aepack.py]=1 # Fails on its own
[test_aepack.py]=1 # it fails on its own
[test_al.py]=1 # it fails on its own
[test_anydbm.py]=1 # it fails on its own
[test_applesingle.py]=1 # it fails on its own
[test_bsddb185.py]=1 # it fails on its own
[test_bsddb3.py]=1 # it fails on its own
[test_bsddb.py]=1 # it fails on its own
[test_cd.py]=1 # it fails on its own
[test_cl.py]=1 # it fails on its own
[test_codecmaps_cn.py]=1 # it fails on its own
[test_codecmaps_jp.py]=1 # it fails on its own
[test_codecmaps_kr.py]=1 # it fails on its own
[test_codecmaps_tw.py]=1 # it fails on its own
[test_commands.py]=1 # it fails on its own
[test_curses.py]=1 # it fails on its own
[test_dbm.py]=1 # it fails on its own
[test_descr.py]=1
[test_doctest.py]=1 #
[test_dis.py]=1 # We change line numbers - duh!
[test_dl.py]=1 # it fails on its own
[test_file.py]=1 # it fails on its own
[test_future5.py]=1 # it fails on its own
[test_generators.py]=1 # Investigate
[test_gl.py]=1 # it fails on its own
[test_grp.py]=1 # Long test - might work Control flow?
[test_imageop.py]=1 # it fails on its own
[test_imaplib.py]=1 # it fails on its own
[test_imgfile.py]=1 # it fails on its own
[test_ioctl.py]=1 # it fails on its own
[test_kqueue.py]=1 # it fails on its own
[test_linuxaudiodev.py]=1 # it fails on its own
[test_macos.py]=1 # it fails on its own
[test_macostools.py]=1 # it fails on its own
[test_mailbox.py]=1 # FIXME: release 3.6.2 may have worked
[test_normalization.py]=1 # it fails on its own
[test_ossaudiodev.py]=1 # it fails on its own
[test_pep277.py]=1 # it fails on its own
[test_pep352.py]=1 # Investigate
[test_pyclbr.py]=1 # Investigate
[test_pwd.py]=1 # Long test - might work? Control flow?
[test_py3kwarn.py]=1 # it fails on its own
[test_scriptpackages.py]=1 # it fails on its own
[test_select.py]=1 # test takes too long to run: 11 seconds
[test_socket.py]=1 # test takes too long to run: 12 seconds
[test_startfile.py]=1 # it fails on its own
[test_structmembers.py]=1 # it fails on its own
[test_sunaudiodev.py]=1 # it fails on its own
[test_support.py]=1 # # it fails on it s own
[test_threading.py]=1 # fails on its own?
[test_trace.py]=1 # Line numbers are expected to be different
[test_urllib2_localnet.py]=1 # test takes too long to run: 12 seconds
[test_urllib2net.py]=1 # test takes too long to run: 11 seconds
[test_urllibnet.py]=1 # it fails on its own
[test_whichdb.py]=1 # it fails on its own
[test_winreg.py]=1 # it fails on its own
[test_winsound.py]=1 # it fails on its own
[test_zipimport_support.py]=1
[test_zipfile64.py]=1 # Skip Long test
[test_zlib.py]=1 #
# .pyenv/versions/2.6.9/lib/python2.6/lib2to3/refactor.pyc
# .pyenv/versions/2.6.9/lib/python2.6/pyclbr.pyc
)
# About 305 unit-test files in about 12 minutes
if (( batch )) ; then
# Fails in crontab environment?
# Figure out what's up here
SKIP_TESTS[test_aifc.py]=1
SKIP_TESTS[test_array.py]=1
# SyntaxError: Non-ASCII character '\xdd' in file test_base64.py on line 153, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
SKIP_TESTS[test_base64.py]=1
SKIP_TESTS[test_decimal.py]=1 # Might be a POWER math thing
# output indicates expected == output, but this fails anyway.
# Maybe the underlying encoding is subtlely different so it
# looks the same?
fi

View File

@@ -0,0 +1,49 @@
SKIP_TESTS=(
[test_bsddb3.py]=1 # test takes too long to run: 110 seconds
[test_compile.py]=1 # Code introspects on co_consts in a non-decompilable way
[test_curses.py]=1 # Possibly fails on its own but not detected
[test_cmd_line.py]=1 # Takes too long, maybe hangs, or looking for interactive input?
[test_dis.py]=1 # We change line numbers - duh!
[test_doctest.py]=1 # Fails on its own
[test_exceptions.py]=1
[test_format.py]=1 # Control flow "and" vs nested "if"
[test_grammar.py]=1 # Too many stmts. Handle large stmts
[test_grp.py]=1 # test takes to long, works interactively though
[test_io.py]=1 # Test takes too long to run
[test_ioctl.py]=1 # Test takes too long to run
[test_lib2to3.py]=1 # test takes too long to run: 28 seconds
[test_math.py]=1
[test_memoryio.py]=1 # FIX
[test_modulefinder.py]=1 # FIX
[test_multiprocessing.py]=1 # On uncompyle2, takes 24 secs
[test_poll.py]=1 # test takes too long to run: 11 seconds
[test_pwd.py]=1 # Takes too long
[test_regrtest.py]=1 #
[test_runpy.py]=1 # Long and fails on its own
[test_select.py]=1 # Runs okay but takes 11 seconds
[test_socket.py]=1 # Runs ok but takes 22 seconds
[test_ssl.py]=1 #
[test_subprocess.py]=1 # Runs ok but takes 22 seconds
[test_sys_settrace.py]=1 # Line numbers are expected to be different
[test_tokenize.py]=1 # test takes too long to run: 19 seconds
[test_traceback.py]=1 # Line numbers change - duh.
[test_unicode.py]=1 # Too long to run 11 seconds
[test_xpickle.py]=1 # Runs ok but takes 72 seconds
[test_zipfile64.py]=1 # Runs ok but takes 204 seconds
[test_zipimport.py]=1 #
)
# 334 unit-test files in about 15 minutes
if (( batch )) ; then
# Fails in crontab environment?
# Figure out what's up here
SKIP_TESTS[test_array.py]=1
SKIP_TESTS[test_ast.py]=1
SKIP_TESTS[test_audioop.py]=1
SKIP_TESTS[test_doctest2.py]=1 # a POWER thing?
SKIP_TESTS[test_httplib.py]=1 # Ok, but POWER has problems with this
SKIP_TESTS[test_pdb.py]=1 # Ok, but POWER has problems with this
# SyntaxError: Non-ASCII character '\xdd' in file test_base64.py on line 153, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
SKIP_TESTS[test_base64.py]=1
fi

View File

@@ -0,0 +1,48 @@
SKIP_TESTS=(
[test_decorators.py]=1 # FIXME: Works on c90ff51
[test_optparse.py]=1 # FIXME: Works on c90ff51
[test_os.py]=1 # FIXME: Works on c90ff51
[test_pyclbr.py]=1 # FIXME: Works on c90ff51
[test_strftime.py]=1 # FIXME: Works on c90ff51
[test_binop.py]=1 # FIXME: Works on c90ff51?
[test_cgi.py]=1 # FIXME: Works on c90ff51?
[test_descr.py]=1 # FIXME: Works on c90ff51?
[test_doctest2.py]=1 # FIXME: Works on c90ff51?
[test_cmd_line.py]=1
[test_collections.py]=1
[test_concurrent_futures.py]=1 # too long to run over 46 seconds by itself
[test_datetimetester.py]=1
[test_decimal.py]=1
[test_dictcomps.py]=1 # FIXME: semantic error: actual = {k:v for k in }
[test_doctest.py]=1 # test failures
[test_dis.py]=1 # We change line numbers - duh!
[test_exceptions.py]=1 # parse error
[test_modulefinder.py]=1 # test failures
[test_multiprocessing.py]=1 # test takes too long to run: 35 seconds
[test_peepholer.py]=1
[test_pep352.py]=1
[test_quopri.py]=1 # TypeError: Can't convert 'bytes' object to str implicitly
[test_runpy.py]=1
[test_ssl.py]=1 # too installation specific
[test_startfile.py]=1 # fails on its own
[test_subprocess.py]=1 # fails on its own
[test_tcl.py]=1 # it fails on its own
[test_tk.py]=1 # it fails on its own
[test_traceback.py]=1 # it fails on its own
[test_zipfile64.py]=1 # Too long to run
)
if (( batch )) ; then
# Fails in crontab environment?
# Figure out what's up here
SKIP_TESTS[test_exception_variations.py]=1
SKIP_TESTS[test_quopri.py]=1
fi

View File

@@ -0,0 +1,80 @@
SKIP_TESTS=(
[test_binop.py]=1 # FIXME: Works on c90ff51
[test_cgi.py]=1 # FIXME: Works on c90ff51
[test_decorators.py]=1 # FIXME: Works on c90ff51
[test_pyclbr.py]=1 # FIXME: Works on c90ff51
[test_optparse.py]=1 # FIXME: Works on c90ff51
[test_os.py]=1 # FIXME: Works on c90ff51
[test_pep352.py]=1 # FIXME: Works on c90ff51
[test_pyclbr.py]=1 # FIXME: Works on c90ff51
[test_shutil.py]=1 # FIXME: Works on c90ff51
[test_strftime.py]=1 # FIXME: Works on c90ff51
[test_symtable.py]=1 # FIXME: Works on c90ff51
[test_atexit.py]=1 # The atexit test starting at 3.3 looks for specific comments in error lines
[test_buffer.py]=1 # parse error
[test_cmd_line.py]=1 # too long?
[test_concurrent_futures.py]=1 # too long?
[test_decimal.py]=1 # test takes too long to run: 18 seconds
[test_descr.py]=1 # test assertion errors
[test_doctest.py]=1 # test assertion errors
[test_doctest2.py]=1 # test assertion errors
[test_dis.py]=1 # We change line numbers - duh!
[test_exceptions.py]=1 #
[test_faulthandler.py]=1
[test_fork1.py]=1 # test takes too long to run: 12 seconds
[test_grammar.py]=1
[test_io.py]=1 # test takes too long to run: 34 seconds
[test_lib2to3.py]=1
[test_logging.py]=1 # test takes too long to run: 13 seconds
[test_long.py]=1 # test assert failure AttributeError: 'Rat' object has no attribute 'd'
[test_math.py]=1
[test_modulefinder.py]=1
[test_multiprocessing.py]=1
[test_nntplib.py]=1
[test_peepholer.py]=1
[test_poll.py]=1 # test takes too long to run: 11 seconds
[test_pty.py]=1 # FIXME: Needs grammar loop isolation separation
[test_queue.py]=1
[test_re.py]=1
[test_resource.py]=1
[test_runpy.py]=1
[test_scope.py]=1
[test_select.py]=1
[test_signal.py]=1
[test_socket.py]=1
[test_ssl.py]=1 # too installation specific
[test_subprocess.py]=1 # test takes too long to run: 28 seconds
[test_sys_setprofile.py]=1 # test assertion errors
[test_sys_settrace.py]=1 # test assertion errors
[test_tcl.py]=1 # installation specific; it fails on its own
[test_timeout.py]=1 # Too long to run: 19 seconds
[test_traceback.py]=1 # Probably introspects code
[test_zipfile64.py]=1 # Too long to run
)
# About 300 unit-test files in about 20 minutes
if (( batch )) ; then
SKIP_TESTS[test_ftplib.py]=1 # Runs too long on POWER; over 15 seconds
SKIP_TESTS[test_idle.py]=1 # No tk
SKIP_TESTS[test_pep352.py]=1 # UnicodeDecodeError may be funny on weird environments
SKIP_TESTS[test_pep380.py]=1 # test_delegating_generators_claim_to_be_running ?
# Fails in crontab environment?
# Figure out what's up here
# SKIP_TESTS[test_exception_variations.py]=1
fi

View File

@@ -0,0 +1,79 @@
SKIP_TESTS=(
[test_buffer.py]=1 # FIXME: Works on c90ff51
[test_decorators.py]=1 # FIXME: Works on c90ff51
[test_faulthandler.py]=1 # FIXME: too long to run 20 seconds. Works on c90ff51
[test_decimal.py]=1 # FIXME: Works on c90ff51
[test_optparse.py]=1 # FIXME: Works on c90ff51
[test_os.py]=1 # FIXME: Works on c90ff51
[test_shutil.py]=1 # FIXME: Works on c90ff51
[test_strftime.py]=1 # FIXME: Works on c90ff51
[test___all__.py]=1 # it fails on its own
[test_atexit.py]=1 # The atexit test looks for specific comments in error lines
[test_cmd_line.py]=1 # takes too long to run
[test_concurrent_futures.py]=1 # too long?
[test_configparser.py]=1 # Doesn't terminate
[test_ctypes.py]=1 # it fails on its own
[test_curses.py]=1 # Investigate
[test_dbm_gnu.py]=1 # fails on its own
[test_devpoll.py]=1 # it fails on its own
[test_descr.py]=1 # test assertion errors
[test_dis.py]=1 # We change line numbers - duh!
[test_distutils.py]=1 # it fails on its own
[test_doctest2.py]=1
[test_doctest.py]=1 # test assert failures
[test_docxmlrpc.py]=1
[test_enum.py]=1 # compile syntax?
[test_exceptions.py]=1
[test_faulthandler.py]=1
[test_file_eintr.py]=1 # parse error
[test_fork1.py]=1 # too long
[test_gdb.py]=1 # it fails on its own
[test_grammar.py]=1 # parse error
[test_httplib.py]=1 # it fails on its own
[test_import.py]=1 # it fails on its own
[test_io.py]=1
[test_ioctl.py]=1 # it fails on its own
[test_inspect.py]=1 # Syntax error Investigate
[test_logging.py]=1 # Too long to run
[test_long.py]=1 # FIXME: Works on c90ff51
[test_modulefinder.py]=1 # test assertion error
[test_multiprocessing_fork.py]=1 # doesn't terminate
[test_multiprocessing_forkserver.py]=1 # doesn't terminate
[test_multiprocessing_main_handling.py]=1 # doesn't terminate
[test_multiprocessing_spawn.py]=1 # doesn't terminate
[test_nntplib.py]=1 # too long to run
[test_peepholer.py]=1 # control flow?
[test_pep352.py]=1 # test assert failures
[test_pickle.py]=1 # test assert failures
[test_pkgimport.py]=1 # long
[test_poll.py]=1 # Too long to run: 11 seconds
[test_pydoc.py]=1 # test assertion failures
[test_runpy.py]=1 # Too long:
[test_select.py]=1 # Too long: 11 seconds
[test_selectors.py]=1 # Too long: 11 seconds
[test_signal.py]=1 # Too long: 22 seconds
[test_sndhdr.py]=1
[test_socket.py]=1 # long 25 seconds
[test_socketserver.py]=1 # long 25 seconds
[test_subprocess.py]=1 # Too long
[test_symtable.py]=1 # Investigate bad output
[test_sys_settrace.py]=1 # test assert failures
[test_tcl.py]=1 # May be implementation specific. On POWER though it fails
[test_threading.py]=1 # Too long
[test_threadsignals.py]=1 # Too long to run: 12 seconds
[test_timeout.py]=1 # Too long to run: 19 seconds
[test_traceback.py]=1 # introspects on code
[test_urllib2net.py]=1 # Doesn't terminate
[test_zipfile64.py]=1
[test_zlib.py]=1
)
# 304 unit-test file in about 20 minutes
if (( batch )) ; then
# Fails in crontab environment?
# Figure out what's up here
SKIP_TESTS[test_exception_variations.py]=1
SKIP_TESTS[test_mailbox.py]=1 # Takes to long on POWER; over 15 secs
SKIP_TESTS[test_quopri.py]=1
fi

154
test/stdlib/3.5-exclude.sh Normal file
View File

@@ -0,0 +1,154 @@
SKIP_TESTS=(
[test_buffer.py]=1 # FIXME: Works on c90ff51
[test_decorators.py]=1 # FIXME: Works on c90ff51
[test_faulthandler.py]=1 # FIXME: too long to run 20 seconds. Works on c90ff51
[test_ftplib.py]=1 # Works on c90ff51
[test_marshal.py]=1 # FIXME: Works on c90ff51
[test_optparse.py]=1 # FIXME: Works on c90ff51
[test_os.py]=1 # FIXME: Works on c90ff51
[test_platform.py]=1 # FIXME: Works on c90ff51
[test_poplib.py]=1 # FIXME: Works on c90ff51
[test_pyclbr.py]=1 # FIXME: Works on c90ff51
[test_smtplib.py]=1 # FIXME: Works on c90ff51
[test_strftime.py]=1 # FIXME: Works on c90ff51
[test_shutil.py]=1 # FIXME: Works on c90ff51
[test_sysconfig.py]=1 # FIXME: Works on c90ff51
[test_tempfile.py]=1 # FIXME: Works on c90ff51
[test_uu.py]=1 # FIXME: Works on c90ff51
[test___all__.py]=1 # it fails on its own
[test_aifc.py]=1 #
[test_asdl_parser.py]=1 # it fails on its own
[test_atexit.py]=1 # The atexit test looks for specific comments in error lines
[test_bisect.py]=1 # it fails on its own
[test_cmath]=1
[test_cmd_line.py]=1 #
[test_codecmaps_cn.py]=1 # it fails on its own
[test_codecmaps_hk.py]=1 # it fails on its own
[test_codecmaps_jp.py]=1 # it fails on its own
[test_codecmaps_kr.py]=1 # it fails on its own
[test_codecmaps_tw.py]=1 # it fails on its own
[test_codecs.py]=1 # test assertion failure
[test_collections.py]=1
[test_compile.py]=1 # Code introspects on co_consts in a non-decompilable way
[test_concurrent_futures.py]=1 # Takes long to run
[test_coroutines.py]=1 # Syntax error Investigate
[test_curses.py]=1 #
[test_devpoll.py]=1 # it fails on its own
[test_dict.py]=1 #
[test_dis.py]=1 # We change line numbers - duh!
[test_distutils.py]=1 # it fails on its own
[test_dbm_ndbm.py]=1 # it fails on its own
[test_descr.py]=1 # test assertion errors
[test_doctest2.py]=1 #
[test_doctest.py]=1 #
[file_eintr.py]=1
[test_enum.py]=1 #
[test_exceptions.py]=1 # parse error
[test_format.py]=1
[test_gdb.py]=1 # it fails on its own
[test_glob.py]=1 #
[test_grammar.py]=1 # parse error
[test_grp.py]=1 # Long test
[test_heapq.py]=1 # test assertion failures
[test_imaplib.py]=1
[test_inspect.py]=1 # Syntax error Investigate
[test_io.py]=1 # Long run time.
[test_logging.py]=1 #
[test_long.py]=1 # too long run time: 20 seconds
[test_math.py]=1 # test assertion errors TypeError: a float is required
[test_modulefinder.py]=1 # test assertion error
[test_msilib.py]=1 # it fails on its own
[test_multiprocessing_fork.py]=1 # long
[test_multiprocessing_forkserver.py]=1 # long
[test_multiprocessing_spawn.py]=1 # long
[test_nntplib.py]=1 # too long 25 seconds
[test_normalization.py]=1 # it fails on its own
[test_pdb.py]=1 # probably relies on comments in code
[test_peepholer.py]=1 # parse error; Investigate
[test_pep352.py]=1 # test assertion error
[test_pep380.py]=1 # Investigate test assertion differ
[test_pickle.py]=1 # test assert errors
[test_pkgimport.py]=1 # long
[test_pkgutil.py]=1 # it fails on its own
[test_print.py]=1 # test assert errors
[test_pty.py]=1 # FIXME: Needs grammar loop isolation separation
[test_pydoc.py]=1 # test assertion: help text difference
[test_queue.py]=1 # Possibly parameter differences - investigate
[test_raise.py]=1 # Test assert error
[test_regrtest.py]=1 # test assertion errors
[test_robotparser.py]=1 # fails on its own
[test_runpy.py]=1 # decompile takes too long?
[test_sched.py]=1
[test_scope.py]=1
[test_select.py]=1 # Takes too long 11 seconds
[test_selectors.py]=1 # Takes too long 17 seconds
[test_set.py]=1 # # test assert failure and doesn't terminate
[test_signal.py]=1 # too long?
[test_smtpd.py]=1 # test failures
[test_socket.py]=1 # long
[test_socketserver.py]=1
[test_strtod.py]=1 # Test assert failure
[test_subprocess.py]=1
[test_sys_setprofile.py]=1 # test assert fail
[test_sys_settrace.py]=1 # test assert fail
[test_tcl.py]=1 # it fails on its own
[test_thread.py]=1
[test_threading.py]=1
[test_timeout.py]=1
[test_trace.py]=1 # it fails on its own
[test_traceback.py]=1
[test_ttk_guionly.py]=1 # it fails on its own
[test_ttk_textonly.py]=1 # it fails on its own
[test_typing.py]=1 # investigate syntax error
[test_urllib.py]=1 # it fails on its own
[test_urllib2.py]=1 # it fails on its own
[test_urllib2_localnet.py]=1 # doesn't terminate
[test_urllib2net.py]=1 # it fails on its own
[test_urllibnet.py]=1 # it fails on its own
[test_urlparse.py]=1 # test assert error
[test_winreg.py]=1 # it fails on its own
[test_winsound.py]=1 # it fails on its own
[test_xmlrpc.py]=1
[test_zipfile64.py]=1
[test_zipimport.py]=1
[test_zipimport_support.py]=1
[test_zipfile.py]=1 # it fails on its own
[test_zlib.py]=1
)
# About 260 unit-test in about 16 minutes
if (( batch )) ; then
# Fails in crontab environment?
# Figure out what's up here
SKIP_TESTS[test_bisect.py]=1
SKIP_TESTS[test_buffer.py]=1 # too long
SKIP_TESTS[test_compileall.py]=1 # Something weird on POWER
SKIP_TESTS[test_codeccallbacks.py]=1 # Something differenet in locale?
SKIP_TESTS[test_distutils.py]=1
SKIP_TESTS[test_exception_variations.py]=1
SKIP_TESTS[test_quopri.py]=1
SKIP_TESTS[test_ioctl.py]=1 # it fails on its own
SKIP_TESTS[test_tarfile.py]=1 # too long to run on POWER 15 secs
SKIP_TESTS[test_venv.py]=1 # takes too long 11 seconds
fi

202
test/stdlib/3.6-exclude.sh Normal file
View File

@@ -0,0 +1,202 @@
SKIP_TESTS=(
[test_binop.py]=1 # FIXME: Works on c90ff51
[test_cmath.py]=1 # FIXME: Works on c90ff51
[test_decorators.py]=1 # FIXME: Works on c90ff51
[test_format.py]=1 # FIXME: works on c90ff51
[test_locale.py]=1 # FIXME: Works on c90ff51
[test_optparse.py]=1 # FIXME: Works on c90ff51
[test_os.py]=1 # FIXME: Works on c90ff51
[test_pyclbr.py]=1 # FIXME: Works on c90ff51
[test_sort.py]=1 # FIXME: Works on c90ff51
[test_strftime.py]=1 # FIXME: Works on c90ff51
[test___all__.py]=1 # it fails on its own
[test_aifc.py]=1 #
[test_argparse.py]=1 # it fails on its own
[test_asdl_parser.py]=1 # it fails on its own
[test_asyncgen.py]=1 # parse error
[test_atexit.py]=1 # The atexit test looks for specific comments in error lines
[test_baseexception.py]=1 # test assert error
[test_bdb.py]=1 #
[test_bisect.py]=1 # it fails on its own
[test_buffer.py]=1 # parse error
[test_builtin.py]=1 # Fails on its own
[test test_capi.py]=1 # it fails on its own
[test_cmd_line.py]=1 # Interactive?
[test_codecencodings_cn.py]=1 # it fails on its own
[test_codecencodings_hk.py]=1 # it fails on its own
[test_codecencodings_iso2022.py]=1 # it fails on its own
[test_codecencodings_jp.py]=1 # it fails on its own
[test_codecencodings_kr.py]=1 # it fails on its own
[test_codecencodings_tw.py]=1 # it fails on its own
[test_codecmaps_cn.py]=1 # it fails on its own
[test_codecmaps_hk.py]=1 # it fails on its own
[test_codecmaps_jp.py]=1 # it fails on its own
[test_codecmaps_kr.py]=1 # it fails on its own
[test_codecmaps_tw.py]=1 # it fails on its own
[test_codecs.py]=1
[test_collections.py]= # it fails on its own
[test_compile.py]=1 # Code introspects on co_consts in a non-decompilable way
[test_concurrent_futures.py]=1 # Takes long
[test_contextlib.py]=1 # test assertion failure
[test_contextlib_async.py]=1 # Investigate
[test_coroutines.py]=1 # Parse error
[test_curses.py]=1 # Parse error
[test_ctypes.py]=1 # it fails on its own
[test_datetime.py]=1 # it fails on its own
[test_dbm_ndbm.py]=1 # it fails on its own
[test_decimal.py]=1
[test_descr.py]=1 # syntax error: Investigate
[test_devpoll.py]=1 # it fails on its own
[test_dict.py]=1 # it fails on its own
[test_dis.py]=1 # We change line numbers - duh!
[test_doctest2.py]=1 #
[test_doctest.py]=1 #
[test_docxmlrpc.py]=1 # it fails on its own
[test_dtrace.py]=1 # it fails on its own
[test_dummy_thread.py]=1 # it fails on its own
[test_enum.py]=1 #
[test_exceptions.py]=1 # parse error
[test_filecmp.py]=1 # parse error
[test_file_eintr.py]=1 # parse error
[test_fileinput.py]=1 # doesn't terminate
[test_finalization.py]=1
[test_float.py]=1 # it fails on its own
[test_functools.py]=1 # it fails on its own
[test_fstring.py]=1 # need to disambiguate leading fstrings from docstrings
[test___future__.py]=1 # syntax error: Investigate
[test_gdb.py]=1 # it fails on its own
[test_generators.py]=1 # FIXME: Invalid syntax: f2 = lambda : (yield from g()) if False:
[test_genexps.py]=1 #
[test_glob.py]=1 #
[test_grammar.py]=1 # parse error
[test_hashlib.py]=1 # it fails on its own
[test_heapq.py]=1 # it fails on its own
[test_io.py]=1 # it fails on its own
[test_imaplib.py]=1
[test_inspect.py]=1 # Syntax error Investigate
[test_itertools.py]=1 # test assertion failures
[test_kqueue.py]=1 # it fails on its own
[test_lib2to3.py]=1 # it fails on its own
[test_logging.py]=1 # it fails on its own
[test_long.py]=1 #
[test_lzma.py]=1 # fails on its own
[test_mailbox.py]=1 # it fails on its own
[test_marshal.py]=1 #
[test_math.py]=1 # test assert errors call param Investigate
[test_metaclass.py]=1
[test_modulefinder.py]=1 # test assertion error
[test_msilib.py]=1 # it fails on its own
[test_multiprocessing_fork.py]=1 # it fails on its own
[test_multiprocessing_forkserver.py]=1 # it fails on its own
[test_multiprocessing_main_handling.py]=1 # takes too long - 11 seconds
[test_multiprocessing_spawn.py]=1 # it fails on its own
[test_nntplib.py]=1 # test takes too long to run: 31 seconds
[test_normalization.py]=1 # it fails on its own
[test_ordered_dict.py]= # it fails on its own
[test_ossaudiodev.py]=1 # it fails on its own
[test_pdb.py]=1 # Probably introspection
[test_peepholer.py]=1
[test_pickle.py]=1
[test_pkgimport.py]=1 # it fails on its own
[test_platform.py]=1
[test_plistlib.py]=1
[test_poll.py]=1 # Takes too long 11 seconds
[test_poplib.py]=1
[test_pprint.py]=1 # it fails on its own
[test_pulldom.py]=1
[test_pyclbr.py]=1 # it fails on its own
[test_pydoc.py]=1 # it fails on its own
[test_quopri.py]=1 # AssertionError: b'123=four' != '123=four'
[test_random.py]=1 # it fails on its own
[test_range.py]=1
[test_regrtest.py]=1 # test takes too long to run: 12 seconds
[test_robotparser.py]=1
[test_runpy.py]=1 # decompile takes too long?
[test_sax.py]=1 # it fails on its own
[test_sched.py]=1
[test_scope.py]=1
[test_secrets.py]=1 # it fails on its own
[test_select.py]=1 # test takes too long to run: 11 seconds
[test_selectors.py]=1 # it fails on its own
[test_shutil.py]=1 # it fails on its own
[test_signal.py]=1 # it fails on its own
[test_site.py]=1 # it fails on its own
[test_smtpd.py]=1
[test_smtplib.py]=1 # it fails on its own
[test_socket.py]=1 # long
[test_socketserver.py]=1
[test_ssl.py]=1 # it fails on its own
[test_startfile.py]=1 # it fails on its own
[test_statistics.py]=1 # it fails on its own
[test_string_literals.py]=1
[test_strtod.py]=1 # it fails on its own
[test_struct.py]=1 # test assertion errors
[test_subprocess.py]=1
[test_sys.py]=1 # Investigate confusing "and" with nested "if" when there is an "else
[test_sys_settrace.py]=1 # parse error
[test_tarfile.py]=1 # it fails on its own
[test_tcl.py]=1 # Test assert failures
[test_telnetlib.py]=1 # takes more than 15 seconds to run
[test_thread.py]=1 # it fails on its own
[test_threading.py]=1
[test_threadsignals.py]=1
[test_timeout.py]=1
[test_tix.py]=1 # it fails on its own
[test_tk.py]=1 # it fails on its own
[test_tokenize.py]=1 # test takes too long to run: 80 seconds
[test_trace.py]= # it fails on its own
[test_traceback.py]=1
[test_tracemalloc.py]=1
[test_ttk_guionly.py]= # it fails on its own
[test_ttk_textonly.py]=1 # it fails on its own
[test_turtle.py]=1 # it fails on its own
[test_typing.py]=1 # investigate syntax error
[test_ucn.py]=1 # it fails on its own
[test_urllib2_localnet.py]=1 # long
[test_urllib2net.py]=1 # it fails on its own
[test_urllib2.py]=1 # it fails on its own
[test_urllibnet.py]=1 # it fails on its own
[test_urllib.py]=1 # it fails on its own
[test_venv.py]=1 # test takes too long to run: 13 seconds
[test_weakref.py]=1
[test_winconsoleio.py]=1 # it fails on its own
[test_winreg.py]=1 # it fails on its own
[test_winsound.py]=1 # it fails on its own
[test_xmlrpc.py]=1 # it fails on its own
[test_zipfile.py]=1 # Too long - 11 seconds
[test_zipfile64.py]=1
[test_zipimport.py]=1
[test_zipimport_support.py]=1
[test_zlib.py]=1
)
# 236 unit-test files in about 13 minutes
if (( batch )) ; then
SKIP_TESTS[test_codeccallbacks.py]=1
# locale on test machine is probably customized
SKIP_TESTS[test__locale.py]=1
fi

136
test/stdlib/3.7-exclude.sh Normal file
View File

@@ -0,0 +1,136 @@
SKIP_TESTS=(
[test___all__.py]=1 # it fails on its own
[test_argparse.py]=1 #- it fails on its own
[test_asdl_parser.py]=1 # it fails on its own
[test_ast.py]=1 # Depends on comments in code
[test_atexit.py]=1 # The atexit test looks for specific comments in error lines
[test_baseexception.py]=1 # UnboundLocalError: local variable 'exc' referenced before assignment
[test_bdb.py]=1 #
[test_buffer.py]=1 # test assertion errors
[test_builtin.py]=1 # parse error, but decompyle3 doesn't have this. (It has test assert failures though)
[test_clinic.py]=1 # it fails on its own
[test_cmath.py]=1 # test assertion failure
[test_cmd_line.py]=1 # Interactive?
[test_cmd_line_script.py]=1
[test_compare.py]=1 # Weird test assert faiure AssertionError: [1] == [1]
[test_compileall.py]=1 # fails on its own
[test_compile.py]=1 # Code introspects on co_consts in a non-decompilable way
[test_concurrent_futures.py]=1 # too long
[test_context.py]=1
[test_coroutines.py]=1 # Investigate: Parse error - async/yield stuff?
[test_codecs.py]=1 # test assert failures; encoding/decoding stuff
[test_ctypes.py]=1 # it fails on its own
[test_curses.py]=1 # probably byte string not handled properly
[test_dataclasses.py]=1 # FIXME: control flow probably: AssertionError: unknown result 'exception'
[test_datetime.py]=1 # Takes too long
[test_dbm_gnu.py]=1 # Takes too long
[test_dbm_ndbm.py]=1 # it fails on its own
[test_decimal.py]=1 # test assertion failures
[test_descr.py]=1 # test assertion failures
[test_devpoll.py]=1 # it fails on its own
[test_dis.py]=1 # We change line numbers - duh!
[test_doctest2.py]=1 # FIXME: assert failure - works on decompyle3
[test_docxmlrpc.py]=1
[test_enum.py]=1 # probably bad control flow
[test_faulthandler.py]=1 # takes too long
[test_fcntl.py]=1
[test_fileinput.py]=1 # Test assertion failures
[test_format.py]=1 # Probably not handling bytestrings properly
[test_frame.py]=1 # test assertion errors
[test_ftplib.py]=1 # parse error
[test_functools.py]=1 # parse error
[test_fstring.py]=1 # need to disambiguate leading fstrings from docstrings
[test_gdb.py]=1 # it fails on its own
[test_generators.py]=1 # Investigate improper lamdba with bogus "False" added
[test_glob.py]=1 # TypeError: join() argument must be str or bytes, not 'tuple'
[test_grammar.py]=1 # investigate: index out of range in decompiler (template_engine?)
[test_grp.py]=1 # Doesn't terminate (killed)
[test_hashlib.py]=1 # test assert failures
[test_imaplib-3.7.py]=1 # test assert failures
[test_idle.py]=1 # Probably installation specific
[test_io.py]=1 # test takes too long to run: 37 seconds
[test_imaplib.py]=1 # test assert failures
[test_inspect.py]=1 # Investigate test failures involving lambda
[test_kqueue.py]=1 # it fails on its own
[test_lib2to3.py]=1 # it fails on its own
[test_long.py]=1 # FIX: if boundaries wrong in Rat __init__
[test_logging.py]=1 # test takes too long to run: 20 seconds
[test_mailbox.py]=1
[test_marshal.py]=1
[test_math.py]=1 # test assert failures
[test_modulefinder.py]=1
[test_msilib.py]=1
[test_multiprocessing_fork.py]=1 # test takes too long to run: 62 seconds
[test_multiprocessing_forkserver.py]=1
[test_multiprocessing_spawn.py]=1
[test_normalization.py]=1 # probably control flow (uninitialized variable)
[test_nntplib.py]=1
[test_optparse.py]=1 # doesn't terminate at test_consume_separator_stop_at_option
[test_os.py]=1 # probably control flow (uninitialized variable)
[test_ossaudiodev.py]=1 # it fails on its own
[test_pdb.py]=1 # Probably relies on comments
[test_peepholer.py]=1 # test assert error
[test_pickle.py]=1 # Probably relies on comments
[test_poll.py]=1
[test_poplib.py]=1
[test_pydoc.py]=1 # it fails on its own
[test_runpy.py]=1 #
[test_pkg.py]=1 # Investigate: lists differ
[test_pkgutil.py]=1 # Investigate:
[test_platform.py]=1 # probably control flow: uninitialized variable
[test_pow.py]=1 # probably control flow: test assertion failure
[test_pwd.py]=1 # killing - doesn't terminate
[test_regrtest.py]=1 # lists differ
[test_re.py]=1 # test assertion error
[test_richcmp.py]=1 # parse error
[test_select.py]=1 # test takes too long to run: 11 seconds
[test_selectors.py]=1
[test_shutil.py]=1 # fails on its own
[test_signal.py]=1 #
[test_slice.py]=1 # test assert error in data; Investigate
[test_smtplib.py]=1 #
[test_socket.py]=1
[test_socketserver.py]=1
[test_sort.py]=1 # Probably control flow; unintialized varaible
[test_ssl.py]=1 # Probably control flow; unintialized varaible
[test_startfile.py]=1 # it fails on its own
[test_statistics.py]=1 # Probably control flow; unintialized varaible
[test_string_literals.py]=1 # Investigate boolean parsing
[test_strptime.py]=1 # test assertions failed
[test_strtod.py]=1 # test assertions failed
[test_structmembers.py]=1 # test assertions failed
[test_struct.py]=1 # test assertions failed
[test_subprocess.py]=1
[test_sys_setprofile.py]=1 # test assertions failed
[test_sys_settrace.py]=1 # parse error
[test_tarfile.py]=1 # test assertions failed
[test_threading.py]=1 #
[test_timeit.py]=1 # probably control flow uninitialized variable
[test_tk.py]=1 # test takes too long to run: 13 seconds
[test_tokenize.py]=1
[test_trace.py]=1 # it fails on its own
[test_traceback.py]=1 # Probably uses comment for testing
[test_tracemalloc.py]=1 #
[test_ttk_guionly.py]=1 # implementation specfic and test takes too long to run: 19 seconds
[test_typing.py]=1 # parse error
[test_types.py]=1 # parse error
[test_unicode.py]=1 # unicode thing
[test_urllib2_localnet.py]=1 #
[test_urllibnet.py]=1 # probably control flow - uninitialized variable
[test_weakref.py]=1 # probably control flow - uninitialized variable
[test_with.py]=1 # probably control flow - uninitialized variable
[test_xml_dom_minicompat.py]=1 # FIXME: parse error; imports again
[test_winconsoleio.py]=1 # it fails on its own
[test_winreg.py]=1 # it fails on its own
[test_winsound.py]=1 # it fails on its own
[test_zipfile.py]=1 # it fails on its own
[test_zipfile64.py]=1 # Too long to run
)
# 278 unit-test files in about 15 minutes
if (( batch )) ; then
SKIP_TESTS[test_distutils.py]=1
SKIP_TESTS[test_fileio.py]=1
SKIP_TESTS[test_gc.py]=1
SKIP_TESTS[test_zipimport_support.py]=1
fi

152
test/stdlib/3.8-exclude.sh Normal file
View File

@@ -0,0 +1,152 @@
SKIP_TESTS=(
[test___all__.py]=1 # it fails on its own
[test_argparse.py]=1 #- it fails on its own
[test_asdl_parser.py]=1 # it fails on its own
[test_ast.py]=1 # Depends on comments in code
[test_atexit.py]=1 # The atexit test looks for specific comments in error lines
[test_baseexception.py]=1 #
[test_bdb.py]=1 #
[test_buffer.py]=1 # parse error
[test_builtin.py]=1 # parse error
[test_clinic.py]=1 # it fails on its own
[test_cmath.py]=1 # test assertion failure
[test_cmd_line.py]=1 # Interactive?
[test_cmd_line_script.py]=1
[test_collections.py]=1
[test_compare.py]=1
[test_compileall.py]=1 # fails on its own
[test_compile.py]=1
[test_concurrent_futures.py]=1 # too long
[test_configparser.py]=1
[test_context.py]=1
[test_coroutines.py]=1 # Parse error
[test_codecs.py]=1
[test_compile.py]=1 # Parse error, but after that, the code introspects on co_consts in a non-decompilable way
[test_complex.py]=1 # Investigate
[test_crypt.py]=1 # Parse error
[test_ctypes.py]=1 # it fails on its own
[test_curses.py]=1 # Parse error
[test_dataclasses.py]=1 # test assertion errors
[test_datetime.py]=1 # Takes too long
[test_dbm_gnu.py]=1 # Takes too long
[test_dbm_ndbm.py]=1 # it fails on its own
[test_decimal.py]=1 # Parse error
[test_descr.py]=1 # Parse error
[test_devpoll.py]=1 # it fails on its own
[test_dictcomps.py]=1 # Bad semantics - Investigate
[test_dis.py]=1 # We change line numbers - duh!
[test_docxmlrpc.py]=1
[test_exceptions.py]=1 # parse error
[test_enumerate.py]=1 #
[test_enum.py]=1 #
[test_faulthandler.py]=1 # takes too long
[test_fcntl.py]=1
[test_fileinput.py]=1
[test_float.py]=1
[test_format.py]=1
[test_frame.py]=1
[test_fstring.py]=1 # Investigate
[test_ftplib.py]=1
[test_functools.py]=1
[test_gdb.py]=1 # it fails on its own
[test_generators.py]=1 # improper decompile of assert i < n and (n-i) % 3 == 0
[test_glob.py]=1 #
[test_grammar.py]=1
[test_grp.py]=1 # Doesn't terminate (killed)
[test_gzip.py]=1 # parse error
[test_hashlib.py]=1 # test assert failures
[test_httplib.py]=1 # parse error
[test_http_cookiejar.py]=1
[test_imaplib-3.7.py]=1
[test_idle.py]=1 # Probably installation specific
[test_io.py]=1 # test takes too long to run: 37 seconds
[test_imaplib.py]=1
[test_index.py]=1
[test_inspect.py]=1
[test_itertools.py]=1 # parse error
[test_keywordonlyarg.py]=1 # parse error
[test_kqueue.py]=1 # it fails on its own
[test_lib2to3.py]=1 # it fails on its own
[test_long.py]=1 # investigate
[test_logging.py]=1 # test takes too long to run: 20 seconds
[test_mailbox.py]=1
[test_marshal.py]=1
[test_math.py]=1
[test_modulefinder.py]=1
[test_msilib.py]=1
[test_multiprocessing_fork.py]=1 # test takes too long to run: 62 seconds
[test_multiprocessing_forkserver.py]=1
[test_multiprocessing_spawn.py]=1
[test_normalization.py]=1 # probably control flow (uninitialized variable)
[test_nntplib.py]=1
[test_optparse.py]=1 # doesn't terminate (killed)
[test_os.py]=1 # probably control flow (uninitialized variable)
[test_ossaudiodev.py]=1 # it fails on its own
[test_pathlib.py]=1 # parse error
[test_pdb.py]=1 # Probably relies on comments
[test_peepholer.py]=1 # decompile takes a long time; then test assert error
[test_pickle.py]=1 # Probably relies on comments
[test_poll.py]=1
[test_poplib.py]=1
[test_pydoc.py]=1 # it fails on its own
[test_runpy.py]=1 #
[test_pkg.py]=1 # parse error; Investigate: lists differ
[test_pkgutil.py]=1 # parse error
[test_platform.py]=1 # parse error
[test_pwd.py]=1 # killing - doesn't terminate
[test_regrtest.py]=1 # parse error; test assertion error: lists differ
[test_re.py]=1 # parse error; test assertion error
[test_richcmp.py]=1 # Investigate: data[i] index error in semantic handling
[test_select.py]=1 # test takes too long to run: 11 seconds
[test_selectors.py]=1
[test_shutil.py]=1 # fails on its own
[test_signal.py]=1 #
[test_slice.py]=1 # Investigate: test assertion error
[test_smtplib.py]=1 #
[test_socket.py]=1
[test_socketserver.py]=1
[test_sort.py]=1 # parse error;
[test_ssl.py]=1 # parse error
[test_startfile.py]=1 # it fails on its own
[test_statistics.py]=1 # Takes more than 15 secs to run. Assert failures
[test_stat.py]=1 # parse error; test assertions failed
[test_string_literals.py]=1 # parse error; Investigate boolean parsing
[test_strptime.py]=1 # test assertions failed
[test_strtod.py]=1 # test assertions failed
[test_structmembers.py]=1 # test assertions failed
[test_struct.py]=1 # test assertions failed
[test_subprocess.py]=1
[test_sys_setprofile.py]=1 # test assertions failed
[test_sys_settrace.py]=1 # parse error
[test_tarfile.py]=1 # parse error
[test_threading.py]=1 #
[test_timeit.py]=1 # probably control flow uninitialized variable
[test_tk.py]=1 # test takes too long to run: 13 seconds
[test_tokenize.py]=1
[test_trace.py]=1 # it fails on its own
[test_traceback.py]=1 # Probably uses comment for testing
[test_tracemalloc.py]=1 #
[test_ttk_guionly.py]=1 # implementation specfic and test takes too long to run: 19 seconds
[test_typing.py]=1 # parse error
[test_types.py]=1 # parse error
[test_unicode.py]=1 # unicode thing
[test_urllib2.py]=1 #
[test_urllib2_localnet.py]=1 #
[test_urllibnet.py]=1 # probably control flow - uninitialized variable
[test_weakref.py]=1 # probably control flow - uninitialized variable
[test_with.py]=1 # probably control flow - uninitialized variable
[test_xml_dom_minicompat.py]=1 # parse error
[test_winconsoleio.py]=1 # it fails on its own
[test_winreg.py]=1 # it fails on its own
[test_winsound.py]=1 # it fails on its own
[test_zipfile.py]=1 # it fails on its own
[test_zipfile64.py]=1 #
)
# 268 About unit-test files, in about 11 minutes

View File

@@ -0,0 +1,3 @@
#!/bin/bash
STOP_ONERROR=0 ./runun33.sh 'test_[a-b]*.py'
STOP_ONERROR=0 ./runun33.sh 'test_[a-b]*.py'

View File

@@ -1,16 +1,48 @@
#!/bin/bash
function displaytime {
printf "ran in "
local T=$1
local D=$((T/60/60/24))
local H=$((T/60/60%24))
local M=$((T/60%60))
local S=$((T%60))
(( $D > 0 )) && printf '%d days ' $D
(( $H > 0 )) && printf '%d hours ' $H
(( $M > 0 )) && printf '%d minutes ' $M
(( $D > 0 || $H > 0 || $M > 0 )) && printf 'and '
printf '%d seconds\n' $S
}
. ../../admin-tools/pyenv-newer-versions
USER=${USER:-rocky}
EMAIL=${EMAIL:-rb@dustyfeet.com}
SUBJECT_PREFIX="stdlib unit testing for"
for VERSION in 2.6.9 2.7.14 3.4.8 3.5.5 3.6.4 ; do
typeset -i RUN_STARTTIME=$(date +%s)
actual_versions=""
DEBUG="" # -x
for VERSION in $PYVERSIONS ; do
typeset -i rc=0
LOGFILE=/tmp/runtests-$VERSION-$$.log
case "$VERSION" in
3.0.1 | 3.1.5 | 3.2.6 | 3.8.1 )
continue
;;
esac
actual_versions="$actual_versions $VERSION"
if ! pyenv local $VERSION ; then
rc=1
else
/bin/bash ./runtests.sh >$LOGFILE 2>&1
STOP_ONERROR=1 /bin/bash $DEBUG ./runtests.sh >$LOGFILE 2>&1
rc=$?
fi
SUBJECT_PREFIX="runtests verify for"
if ((rc == 0)); then
tail -v $LOGFILE | mail -s "$SUBJECT_PREFIX $VERSION ok" ${USER}@localhost
else
@@ -18,3 +50,8 @@ for VERSION in 2.6.9 2.7.14 3.4.8 3.5.5 3.6.4 ; do
tail -v $LOGFILE | mail -s "$SUBJECT_PREFIX $VERSION not ok" $EMAIL
fi
done
typeset -i RUN_ENDTIME=$(date +%s)
(( time_diff = RUN_ENDTIME - RUN_STARTTIME))
elapsed_time=$(displaytime $time_diff)
echo "Run complete $elapsed_time for versions $actual_versions" | mail -s "runtests in $elapsed_time" ${EMAIL}

View File

@@ -28,15 +28,37 @@ MINOR=${FULLVERSION##?.?.}
STOP_ONERROR=${STOP_ONERROR:-1}
typeset -i timeout=15
function timeout_cmd {
(
$@ &
child=$!
trap -- "" SIGTERM
(
sleep "$timeout"
if ps -p $child >/dev/null ; then
echo ""
echo >&1 "**Killing ${2}; takes more than $timeout seconds to run"
kill -TERM ${child}
fi
) &
wait "$child"
)
}
typeset -A SKIP_TESTS
case $PYVERSION in
2.4)
SKIP_TESTS=(
[test_decimal.py]=1 #
[test_dis.py]=1 # We change line numbers - duh!
[test_generators.py]=1 # Investigate
[test_grammar.py]=1 # Too many stmts. Handle large stmts
[test_grp.py]=1 # Long test - might work Control flow?
[test_pep247.py]=1 # Long test - might work? Control flow?
[test_pwd.py]=1 # Long test - might work? Control flow?
[test_pyclbr.py]=1 # Investigate
[test_socketserver.py]=1 # -- test takes too long to run: 40 seconds
[test_threading.py]=1 # test takes too long to run: 11 seconds
[test_thread.py]=1 # test takes too long to run: 36 seconds
@@ -45,107 +67,18 @@ case $PYVERSION in
)
;;
2.5)
SKIP_TESTS=(
[test_dis.py]=1 # We change line numbers - duh!
[test_grammar.py]=1 # Too many stmts. Handle large stmts
[test_grp.py]=1 # Long test - might work Control flow?
[test_pdb.py]=1 # Line-number specific
[test_pep247.py]=1 # "assert xxx or .." not detected properly in check_hash_module()
[test_pep352.py]=1 # Investigate
[test_pwd.py]=1 # Long test - might work? Control flow?
[test_pyclbr.py]=1 # Investigate
[test_struct.py]=1 # "if and" confused for if .. assert and
[test_threading.py]=1 # test takes too long to run: 11 seconds
[test_thread.py]=1 # test takes too long to run: 36 seconds
[test_trace.py]=1 # Line numbers are expected to be different
[test_zipfile64.py]=1 # Runs ok but takes 204 seconds
)
. ./2.5-exclude.sh
;;
2.6)
SKIP_TESTS=(
[test_aepack.py]=1 # Fails on its own
[test_codeccallbacks.py]=1 # Fails on its own
[test_compile.py]=1 # Intermittent - sometimes works and sometimes doesn't
[test_exceptions.py]=1
[test_grp.py]=1 # Long test - might work Control flow?
[test_pep352.py]=1 # Investigate
[test_pprint.py]=1
[test_pyclbr.py]=1 # Investigate
[test_pwd.py]=1 # Long test - might work? Control flow?
[test_trace.py]=1 # Line numbers are expected to be different
[test_urllib2net.py]=1 # Fails on its own. May need interactive input
[test_zipfile64.py]=1 # Skip Long test
[test_zlib.py]=1 # Takes too long to run (more than 3 minutes 39 seconds)
# .pyenv/versions/2.6.9/lib/python2.6/lib2to3/refactor.pyc
# .pyenv/versions/2.6.9/lib/python2.6/pyclbr.pyc
)
if (( batch )) ; then
# Fails in crontab environment?
# Figure out what's up here
SKIP_TESTS[test_aifc.py]=1
SKIP_TESTS[test_array.py]=1
# SyntaxError: Non-ASCII character '\xdd' in file test_base64.py on line 153, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
SKIP_TESTS[test_base64.py]=1
# output indicates expected == output, but this fails anyway.
# Maybe the underlying encoding is subtlely different so it
# looks the same?
SKIP_TESTS[test_pprint.py]=1
fi
. ./2.6-exclude.sh
;;
2.7)
SKIP_TESTS=(
# These are ok, but our test machine POWER has problems
# so we skip..
[test_httplib.py]=1 # Ok, but POWER has problems with this
[test_pdb.py]=1 # Ok, but POWER has problems with this
[test_capi.py]=1
[test_curses.py]=1 # Possibly fails on its own but not detected
[test_cmd_line.py]=1 # Takes too long, maybe hangs, or looking for interactive input?
[test_compilex.py]=1 # Probably complex literals again. Investigate
[test_dis.py]=1 # We change line numbers - duh!
[test_doctest.py]=1 # Fails on its own
[test_exceptions.py]=1
[test_format.py]=1 # control flow. uncompyle2 does not have problems here
[test_grammar.py]=1 # Too many stmts. Handle large stmts
[test_grp.py]=1 # test takes to long, works interactively though
[test_io.py]=1 # Test takes too long to run
[test_ioctl.py]=1 # Test takes too long to run
[test_long.py]=1
[test_long_future.py]=1
[test_math.py]=1
[test_memoryio.py]=1 # FIX
[test_modulefinder.py]=1 # FIX
[test_multiprocessing.py]=1 # On uncompyle2, takes 24 secs
[test_pwd.py]=1 # Takes too long
[test_pty.py]=1
[test_runpy.py]=1 # Long and fails on its own
[test_select.py]=1 # Runs okay but takes 11 seconds
[test_socket.py]=1 # Runs ok but takes 22 seconds
[test_subprocess.py]=1 # Runs ok but takes 22 seconds
[test_sys_setprofile.py]=1
[test_sys_settrace.py]=1 # Line numbers are expected to be different
[test_traceback.py]=1 # Line numbers change - duh.
[test_unicode.py]=1 # Too long to run 11 seconds
[test_xpickle.py]=1 # Runs ok but takes 72 seconds
[test_zipfile64.py]=1 # Runs ok but takes 204 seconds
)
if (( batch )) ; then
# Fails in crontab environment?
# Figure out what's up here
SKIP_TESTS[test_array.py]=1
SKIP_TESTS[test_ast.py]=1
SKIP_TESTS[test_audioop.py]=1
# SyntaxError: Non-ASCII character '\xdd' in file test_base64.py on line 153, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
SKIP_TESTS[test_base64.py]=1
fi
. ./2.7-exclude.sh
;;
3.0)
SKIP_TESTS=(
[test_array.py]=1 # Handling of bytestring
[test_binascii.py]=1 # handling of bytearray?
[test_concurrent_futures.py]=1 # too long to run over 46 seconds by itself
[test_datetimetester.py]=1
[test_decimal.py]=1
@@ -161,10 +94,7 @@ case $PYVERSION in
;;
3.1)
SKIP_TESTS=(
[test_collections.py]=1
[test_concurrent_futures.py]=1 # too long to run over 46 seconds by itself
[test_datetimetester.py]=1
[test_decimal.py]=1
[test_dis.py]=1 # We change line numbers - duh!
[test_fileio.py]=1
)
@@ -176,128 +106,25 @@ case $PYVERSION in
fi
;;
3.2)
SKIP_TESTS=(
[test_ast.py]=1 # Look at: AssertionError: b'hi' != 'hi'
[test_cmd_line.py]=1
[test_collections.py]=1
[test_concurrent_futures.py]=1 # too long to run over 46 seconds by itself
[test_datetimetester.py]=1
[test_decimal.py]=1
[test_dis.py]=1 # We change line numbers - duh!
[test_quopri.py]=1 # TypeError: Can't convert 'bytes' object to str implicitly
)
if (( batch )) ; then
# Fails in crontab environment?
# Figure out what's up here
SKIP_TESTS[test_exception_variations.py]=1
SKIP_TESTS[test_quopri.py]=1
fi
. ./3.2-exclude.sh
;;
3.3)
SKIP_TESTS=(
[test_atexit.py]=1 #
)
if (( batch )) ; then
# Fails in crontab environment?
# Figure out what's up here
SKIP_TESTS[test_exception_variations.py]=1
SKIP_TESTS[test_quopri.py]=1
fi
. ./3.3-exclude.sh
;;
3.4)
SKIP_TESTS=(
[test_asynchat.py]=1 #
[test_asyncore.py]=1 #
[test_atexit.py]=1 #
[test_bdb.py]=1 #
[test_binascii]=1
[test_dis.py]=1 # We change line numbers - duh!
)
if (( batch )) ; then
# Fails in crontab environment?
# Figure out what's up here
SKIP_TESTS[test_exception_variations.py]=1
SKIP_TESTS[test_quopri.py]=1
fi
. ./3.4-exclude.sh
;;
3.5)
SKIP_TESTS=(
[test_ast.py]=1 # line 379, in test_literal_eval self.assertEqual(ast.literal_eval('b"hi"'), 'hi')
[test_atexit.py]=1 #
[test_builtin.py]=1 #
[test_compare.py]=1
[test_dis.py]=1 # We change line numbers - duh!
)
if (( batch )) ; then
# Fails in crontab environment?
# Figure out what's up here
SKIP_TESTS[test_exception_variations.py]=1
SKIP_TESTS[test_quopri.py]=1
fi
. ./3.5-exclude.sh
;;
3.6)
SKIP_TESTS=(
[test_ast.py]=1 #
[test_atexit.py]=1 #
[test_bdb.py]=1 #
[test_builtin.py]=1 #
[test_compare.py]=1
[test_compile.py]=1
[test_contains.py]=1 # Code "while False: yield None" is optimized away in compilation
[test_contextlib_async.py]=1 # Investigate
[test_coroutines.py]=1 # Parse error
[test_curses.py]=1 # Parse error
[test_dis.py]=1 # We change line numbers - duh!
[test_quopri.py]=1 # AssertionError: b'123=four' != '123=four'
)
. ./3.6-exclude.sh
;;
3.7)
SKIP_TESTS=(
[test_ast.py]=1 #
[test_atexit.py]=1 #
[test_baseexception.py]=1 #
[test_bdb.py]=1 #
[test_buffer.py]=1 # parse error
[test_builtin.py]=1 # parser error
[test_cmdline.py]=1 # Interactive?
[test_collections.py]=1 # Fixed I think in decompyle3 - pull from there
[test_compare.py]=1
[test_compile.py]=1
[test_configparser.py]=1
[test_contains.py]=1 # Code "while False: yield None" is optimized away in compilation
[test_contextlib_async.py]=1 # Investigate
[test_context.py]=1
[test_coroutines.py]=1 # Parse error
[test_crypt.py]=1 # Parse error
[test_curses.py]=1 # Parse error
[test_dataclasses.py]=1 # parse error
[test_datetime.py]=1 # Takes too long
[test_dbm_gnu.py]=1 # Takes too long
[test_decimal.py]=1 # Parse error
[test_descr.py]=1 # Parse error
[test_dictcomps.py]=1 # Bad semantics - Investigate
[test_dis.py]=1 # We change line numbers - duh!
[test_enumerate.py]=1 #
[test_enum.py]=1 #
[test_faulthandler.py]=1 # takes too long
[test_generators.py]=1 # improper decompile of assert i < n and (n-i) % 3 == 0
# ...
)
. ./3.7-exclude.sh
;;
3.8)
SKIP_TESTS=(
[test_contains.py]=1 # Code "while False: yield None" is optimized away in compilation
[test_collections.py]=1 # Investigate
[test_decorators.py]=1 # Control flow wrt "if elif"
[test_exceptions.py]=1 # parse error
[test_dis.py]=1 # We change line numbers - duh!
[test_pow.py]=1 # Control flow wrt "continue"
[test_quopri.py]=1 # Only fails on POWER
# ...
)
. ./3.8-exclude.sh
;;
*)
SKIP_TESTS=( [test_aepack.py]=1
@@ -322,6 +149,13 @@ fi
PYENV_ROOT=${PYENV_ROOT:-$HOME/.pyenv}
pyenv_local=$(pyenv local)
# pyenv version update
for dir in ../ ../../ ; do
cp -v .python-version $dir
done
mkdir $TESTDIR || exit $?
cp -r ${PYENV_ROOT}/versions/${PYVERSION}.${MINOR}/lib/python${PYVERSION}/test $TESTDIR
cd $TESTDIR/test
@@ -354,7 +188,10 @@ for file in $files; do
# If the fails *before* decompiling, skip it!
typeset -i STARTTIME=$(date +%s)
if ! python $file >/dev/null 2>&1 ; then
if [ ! -r $file ]; then
echo "Skipping test $file -- not readable. Does it exist?"
continue
elif ! python $file >/dev/null 2>&1 ; then
echo "Skipping test $file -- it fails on its own"
continue
fi
@@ -377,7 +214,7 @@ for file in $files; do
rc=$?
if (( rc == 0 )) ; then
echo ========== $(date +%X) Running $file ===========
python $file
timeout_cmd python $file
rc=$?
else
echo ======= Skipping $file due to compile/decompile errors ========
@@ -392,7 +229,8 @@ typeset -i ALL_FILES_ENDTIME=$(date +%s)
(( time_diff = ALL_FILES_ENDTIME - ALL_FILES_STARTTIME))
printf "Ran $i unit-test files in "
printf "Ran $i unit-test files, $allerrs errors; Elapsed time: "
displaytime $time_diff
echo "Skipped $skipped test for known failures."
cd $fulldir/../.. && pyenv local $FULLVERSION
exit $allerrs

View File

@@ -1,4 +1,4 @@
# Copyright (C) 2018-2019 Rocky Bernstein <rocky@gnu.org>
# Copyright (C) 2018-2020 Rocky Bernstein <rocky@gnu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -79,35 +79,42 @@ def decompile(
assert iscode(co)
if is_pypy:
co_pypy_str = 'PyPy '
co_pypy_str = "PyPy "
else:
co_pypy_str = ''
co_pypy_str = ""
if IS_PYPY:
run_pypy_str = 'PyPy '
run_pypy_str = "PyPy "
else:
run_pypy_str = ''
run_pypy_str = ""
if magic_int:
m = str(magic_int)
else:
m = ""
sys_version_lines = sys.version.split('\n')
sys_version_lines = sys.version.split("\n")
if source_encoding:
write('# -*- coding: %s -*-' % source_encoding)
write('# uncompyle6 version %s\n'
'# %sPython bytecode %s%s\n# Decompiled from: %sPython %s' %
(VERSION, co_pypy_str, bytecode_version,
" (%s)" % m, run_pypy_str,
'\n# '.join(sys_version_lines)))
write("# -*- coding: %s -*-" % source_encoding)
write(
"# uncompyle6 version %s\n"
"# %sPython bytecode %s%s\n# Decompiled from: %sPython %s" %
(VERSION,
co_pypy_str,
bytecode_version,
" (%s)" % m, run_pypy_str,
"\n# ".join(sys_version_lines),
)
)
if bytecode_version >= 3.0:
write("# Warning: this version has problems handling the Python 3 byte type in contants properly.\n")
if co.co_filename:
write("# Embedded file name: %s" % co.co_filename,)
if timestamp:
write('# Compiled at: %s' %
write("# Compiled at: %s" %
datetime.datetime.fromtimestamp(timestamp))
if source_size:
real_out.write('# Size of source mod 2**32: %d bytes\n' %
real_out.write("# Size of source mod 2**32: %d bytes\n" %
source_size)
debug_opts = {"asm": showasm, "ast": showast, "grammar": showgrammar}

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2015-2019 Rocky Bernstein
# Copyright (c) 2015-2020 Rocky Bernstein
# Copyright (c) 2005 by Dan Pascu <dan@windowmaker.org>
# Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com>
# Copyright (c) 1999 John Aycock
@@ -26,21 +26,24 @@ from xdis.magics import py_str2float
from spark_parser import GenericASTBuilder, DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
from uncompyle6.show import maybe_show_asm
class ParserError(Exception):
def __init__(self, token, offset):
self.token = token
self.offset = offset
def __str__(self):
return "Parse error at or near `%r' instruction at offset %s\n" % \
(self.token, self.offset)
return "Parse error at or near `%r' instruction at offset %s\n" % (
self.token,
self.offset,
)
def nop_func(self, args):
return None
class PythonParser(GenericASTBuilder):
class PythonParser(GenericASTBuilder):
def __init__(self, SyntaxTree, start, debug):
super(PythonParser, self).__init__(SyntaxTree, start, debug)
# FIXME: customize per python parser version
@@ -50,24 +53,32 @@ class PythonParser(GenericASTBuilder):
# stmts -> stmts stmt -> stmts stmt stmt ...
# collect as stmts -> stmt stmt ...
nt_list = [
'stmts', 'except_stmts', '_stmts', 'attributes',
'exprlist', 'kvlist', 'kwargs', 'come_froms', '_come_froms',
'importlist',
"_come_froms",
"_stmts",
"attributes",
"come_froms",
"except_stmts",
"exprlist",
"importlist",
"kvlist",
"kwargs",
"l_stmts",
"stmts",
# Python < 3
'print_items',
"print_items",
# PyPy:
'imports_cont',
'kvlist_n',
"imports_cont",
"kvlist_n",
# Python 3.6+
'come_from_loops',
"come_from_loops",
# Python 3.7+
'importlist37',
]
"importlist37",
]
self.collect = frozenset(nt_list)
# For these items we need to keep the 1st epslion reduction since
# the nonterminal name is used in a semantic action.
self.keep_epsilon = frozenset(('kvlist_n', 'kvlist'))
self.keep_epsilon = frozenset(("kvlist_n", "kvlist"))
# ??? Do we need a debug option to skip eliding singleton reductions?
# Time will tell if it if useful in debugging
@@ -75,20 +86,22 @@ class PythonParser(GenericASTBuilder):
# FIXME: optional_nt is a misnomer. It's really about there being a
# singleton reduction that we can simplify. It also happens to be optional
# in its other derivation
self.optional_nt |= frozenset(('come_froms', 'suite_stmts', 'l_stmts_opt',
'c_stmts_opt'))
self.optional_nt |= frozenset(
("come_froms", "suite_stmts", "l_stmts_opt", "c_stmts_opt", "stmts_opt", "stmt")
)
# Reduce singleton reductions in these nonterminals:
# FIXME: would love to do expr, sstmts, stmts and
# so on but that would require major changes to the
# semantic actions
self.singleton = frozenset(('str', 'store', '_stmts', 'suite_stmts_opt',
'inplace_op'))
self.singleton = frozenset(
("str", "store", "_stmts", "suite_stmts_opt", "inplace_op")
)
# Instructions filled in from scanner
self.insts = []
def ast_first_offset(self, ast):
if hasattr(ast, 'offset'):
if hasattr(ast, "offset"):
return ast.offset
else:
return self.ast_first_offset(ast[0])
@@ -101,6 +114,7 @@ class PythonParser(GenericASTBuilder):
many arguments it has. Often it is not used.
"""
if rule not in self.new_rules:
# print("XXX ", rule) # debug
self.new_rules.add(rule)
self.addRule(rule, nop_func)
customize[opname] = arg_count
@@ -115,7 +129,7 @@ class PythonParser(GenericASTBuilder):
for rule in rules:
if len(rule) == 0:
continue
opname = rule.split('::=')[0].strip()
opname = rule.split("::=")[0].strip()
self.add_unique_rule(rule, opname, 0, customize)
return
@@ -143,49 +157,52 @@ class PythonParser(GenericASTBuilder):
"""Customized format and print for our kind of tokens
which gets called in debugging grammar reduce rules
"""
def fix(c):
s = str(c)
last_token_pos = s.find('_')
last_token_pos = s.find("_")
if last_token_pos == -1:
return s
else:
return s[:last_token_pos]
prefix = ''
prefix = ""
if parent and tokens:
p_token = tokens[parent]
if hasattr(p_token, 'linestart') and p_token.linestart:
prefix = 'L.%3d: ' % p_token.linestart
if hasattr(p_token, "linestart") and p_token.linestart:
prefix = "L.%3d: " % p_token.linestart
else:
prefix = ' '
if hasattr(p_token, 'offset'):
prefix = " "
if hasattr(p_token, "offset"):
prefix += "%3s" % fix(p_token.offset)
if len(rule[1]) > 1:
prefix += '-%-3s ' % fix(tokens[last_token_pos-1].offset)
prefix += "-%-3s " % fix(tokens[last_token_pos - 1].offset)
else:
prefix += ' '
prefix += " "
else:
prefix = ' '
prefix = " "
print("%s%s ::= %s (%d)" % (prefix, rule[0], ' '.join(rule[1]), last_token_pos))
print("%s%s ::= %s (%d)" % (prefix, rule[0], " ".join(rule[1]), last_token_pos))
def error(self, instructions, index):
# Find the last line boundary
start, finish = -1, -1
for start in range(index, -1, -1):
if instructions[start].linestart: break
if instructions[start].linestart:
break
pass
for finish in range(index+1, len(instructions)):
if instructions[finish].linestart: break
for finish in range(index + 1, len(instructions)):
if instructions[finish].linestart:
break
pass
if start > 0:
err_token = instructions[index]
print("Instruction context:")
for i in range(start, finish):
if i != index:
indent = ' '
indent = " "
else:
indent = '-> '
indent = "-> "
print "%s%s" % (indent, instructions[i])
raise ParserError(err_token, err_token.offset)
else:
@@ -196,8 +213,8 @@ class PythonParser(GenericASTBuilder):
represented by the attr field of token"""
# Low byte indicates number of positional paramters,
# high byte number of keyword parameters
args_pos = token.attr & 0xff
args_kw = (token.attr >> 8) & 0xff
args_pos = token.attr & 0xFF
args_kw = (token.attr >> 8) & 0xFF
return args_pos, args_kw
def nonterminal(self, nt, args):
@@ -213,7 +230,7 @@ class PythonParser(GenericASTBuilder):
# stmts -> stmts stmt -> stmts stmt -> ...
# stmms -> stmt stmt ...
#
if not hasattr(args[0], 'append'):
if not hasattr(args[0], "append"):
# Was in self.optional_nt as a single item, but we find we have
# more than one now...
rv = GenericASTBuilder.nonterminal(self, nt, [args[0]])
@@ -228,7 +245,7 @@ class PythonParser(GenericASTBuilder):
rv.append(args[1])
elif n == 1 and args[0] in self.singleton:
rv = GenericASTBuilder.nonterminal(self, nt, args[0])
del args[0] # save memory
del args[0] # save memory
elif n == 1 and nt in self.optional_nt:
rv = args[0]
else:
@@ -241,10 +258,10 @@ class PythonParser(GenericASTBuilder):
return GenericASTBuilder.ambiguity(self, children)
def resolve(self, list):
if len(list) == 2 and 'function_def' in list and 'assign' in list:
return 'function_def'
if 'grammar' in list and 'expr' in list:
return 'expr'
if len(list) == 2 and "function_def" in list and "assign" in list:
return "function_def"
if "grammar" in list and "expr" in list:
return "expr"
# print >> sys.stderr, 'resolve', str(list)
return GenericASTBuilder.resolve(self, list)
@@ -252,17 +269,17 @@ class PythonParser(GenericASTBuilder):
# Common Python 2 and Python 3 grammar rules #
###############################################
def p_start(self, args):
'''
"""
# The start or goal symbol
stmts ::= sstmt+
'''
"""
def p_call_stmt(self, args):
'''
"""
# eval-mode compilation. Single-mode interactive compilation
# adds another rule.
call_stmt ::= expr POP_TOP
'''
"""
def p_stmt(self, args):
"""
@@ -283,6 +300,9 @@ class PythonParser(GenericASTBuilder):
c_stmts_opt ::= c_stmts
c_stmts_opt ::= pass
stmts_opt ::= _stmts
stmts_opt ::= pass
# statements inside a loop
l_stmts ::= _stmts
l_stmts ::= returns
@@ -352,7 +372,7 @@ class PythonParser(GenericASTBuilder):
pass
def p_function_def(self, args):
'''
"""
stmt ::= function_def
function_def ::= mkfunc store
stmt ::= function_def_deco
@@ -362,15 +382,15 @@ class PythonParser(GenericASTBuilder):
mkfuncdeco0 ::= mkfunc
load_closure ::= load_closure LOAD_CLOSURE
load_closure ::= LOAD_CLOSURE
'''
"""
def p_generator_exp(self, args):
'''
"""
expr ::= generator_exp
stmt ::= genexpr_func
genexpr_func ::= LOAD_FAST FOR_ITER store comp_iter JUMP_BACK
'''
"""
def p_jump(self, args):
"""
@@ -390,7 +410,7 @@ class PythonParser(GenericASTBuilder):
"""
def p_augmented_assign(self, args):
'''
"""
stmt ::= aug_assign1
stmt ::= aug_assign2
@@ -416,10 +436,10 @@ class PythonParser(GenericASTBuilder):
inplace_op ::= INPLACE_AND
inplace_op ::= INPLACE_XOR
inplace_op ::= INPLACE_OR
'''
"""
def p_assign(self, args):
'''
"""
stmt ::= assign
assign ::= expr DUP_TOP designList
assign ::= expr store
@@ -428,7 +448,7 @@ class PythonParser(GenericASTBuilder):
stmt ::= assign3
assign2 ::= expr expr ROT_TWO store store
assign3 ::= expr expr expr ROT_THREE ROT_TWO store store store
'''
"""
def p_forstmt(self, args):
"""
@@ -609,8 +629,8 @@ def parse(p, tokens, customize):
def get_python_parser(
version, debug_parser=PARSER_DEFAULT_DEBUG, compile_mode='exec',
is_pypy = False):
version, debug_parser=PARSER_DEFAULT_DEBUG, compile_mode="exec", is_pypy=False
):
"""Returns parser object for Python version 2 or 3, 3.2, 3.5on,
etc., depending on the parameters passed. *compile_mode* is either
'exec', 'eval', or 'single'. See
@@ -631,91 +651,106 @@ def get_python_parser(
if version < 2.2:
if version == 1.0:
import uncompyle6.parsers.parse10 as parse10
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse10.Python10Parser(debug_parser)
else:
p = parse10.Python01ParserSingle(debug_parser)
elif version == 1.1:
import uncompyle6.parsers.parse11 as parse11
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse11.Python11Parser(debug_parser)
else:
p = parse11.Python11ParserSingle(debug_parser)
if version == 1.2:
import uncompyle6.parsers.parse12 as parse12
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse12.Python12Parser(debug_parser)
else:
p = parse12.Python12ParserSingle(debug_parser)
if version == 1.3:
import uncompyle6.parsers.parse13 as parse13
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse13.Python13Parser(debug_parser)
else:
p = parse13.Python13ParserSingle(debug_parser)
elif version == 1.4:
import uncompyle6.parsers.parse14 as parse14
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse14.Python14Parser(debug_parser)
else:
p = parse14.Python14ParserSingle(debug_parser)
elif version == 1.5:
import uncompyle6.parsers.parse15 as parse15
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse15.Python15Parser(debug_parser)
else:
p = parse15.Python15ParserSingle(debug_parser)
elif version == 1.6:
import uncompyle6.parsers.parse16 as parse16
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse16.Python16Parser(debug_parser)
else:
p = parse16.Python16ParserSingle(debug_parser)
elif version == 2.1:
import uncompyle6.parsers.parse21 as parse21
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse21.Python21Parser(debug_parser)
else:
p = parse21.Python21ParserSingle(debug_parser)
elif version == 2.2:
import uncompyle6.parsers.parse22 as parse22
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse22.Python22Parser(debug_parser)
else:
p = parse22.Python22ParserSingle(debug_parser)
elif version == 2.3:
import uncompyle6.parsers.parse23 as parse23
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse23.Python23Parser(debug_parser)
else:
p = parse23.Python23ParserSingle(debug_parser)
elif version == 2.4:
import uncompyle6.parsers.parse24 as parse24
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse24.Python24Parser(debug_parser)
else:
p = parse24.Python24ParserSingle(debug_parser)
elif version == 2.5:
import uncompyle6.parsers.parse25 as parse25
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse25.Python25Parser(debug_parser)
else:
p = parse25.Python25ParserSingle(debug_parser)
elif version == 2.6:
import uncompyle6.parsers.parse26 as parse26
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse26.Python26Parser(debug_parser)
else:
p = parse26.Python26ParserSingle(debug_parser)
elif version == 2.7:
import uncompyle6.parsers.parse27 as parse27
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse27.Python27Parser(debug_parser)
else:
p = parse27.Python27ParserSingle(debug_parser)
else:
import uncompyle6.parsers.parse2 as parse2
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse2.Python2Parser(debug_parser)
else:
p = parse2.Python2ParserSingle(debug_parser)
@@ -724,62 +759,72 @@ def get_python_parser(
pass
else:
import uncompyle6.parsers.parse3 as parse3
if version == 3.0:
import uncompyle6.parsers.parse30 as parse30
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse30.Python30Parser(debug_parser)
else:
p = parse30.Python30ParserSingle(debug_parser)
elif version == 3.1:
import uncompyle6.parsers.parse31 as parse31
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse31.Python31Parser(debug_parser)
else:
p = parse31.Python31ParserSingle(debug_parser)
elif version == 3.2:
import uncompyle6.parsers.parse32 as parse32
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse32.Python32Parser(debug_parser)
else:
p = parse32.Python32ParserSingle(debug_parser)
elif version == 3.3:
import uncompyle6.parsers.parse33 as parse33
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse33.Python33Parser(debug_parser)
else:
p = parse33.Python33ParserSingle(debug_parser)
elif version == 3.4:
import uncompyle6.parsers.parse34 as parse34
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse34.Python34Parser(debug_parser)
else:
p = parse34.Python34ParserSingle(debug_parser)
elif version == 3.5:
import uncompyle6.parsers.parse35 as parse35
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse35.Python35Parser(debug_parser)
else:
p = parse35.Python35ParserSingle(debug_parser)
elif version == 3.6:
import uncompyle6.parsers.parse36 as parse36
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse36.Python36Parser(debug_parser)
else:
p = parse36.Python36ParserSingle(debug_parser)
elif version == 3.7:
import uncompyle6.parsers.parse37 as parse37
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse37.Python37Parser(debug_parser)
else:
p = parse37.Python37ParserSingle(debug_parser)
elif version == 3.8:
import uncompyle6.parsers.parse38 as parse38
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse38.Python38Parser(debug_parser)
else:
p = parse38.Python38ParserSingle(debug_parser)
else:
if compile_mode == 'exec':
if compile_mode == "exec":
p = parse3.Python3Parser(debug_parser)
else:
p = parse3.Python3ParserSingle(debug_parser)
@@ -787,18 +832,25 @@ def get_python_parser(
# p.dump_grammar() # debug
return p
class PythonParserSingle(PythonParser):
def p_call_stmt_single(self, args):
'''
"""
# single-mode compilation. Eval-mode interactive compilation
# drops the last rule.
call_stmt ::= expr PRINT_EXPR
'''
"""
def python_parser(version, co, out=sys.stdout, showasm=False,
parser_debug=PARSER_DEFAULT_DEBUG, is_pypy=False):
def python_parser(
version,
co,
out=sys.stdout,
showasm=False,
parser_debug=PARSER_DEFAULT_DEBUG,
is_pypy=False,
):
"""
Parse a code object to an abstract syntax tree representation.
@@ -815,6 +867,7 @@ def python_parser(version, co, out=sys.stdout, showasm=False,
assert iscode(co)
from uncompyle6.scanner import get_scanner
scanner = get_scanner(version, is_pypy)
tokens, customize = scanner.ingest(co)
maybe_show_asm(showasm, tokens)
@@ -826,10 +879,12 @@ def python_parser(version, co, out=sys.stdout, showasm=False,
return parse(p, tokens, customize)
if __name__ == '__main__':
if __name__ == "__main__":
def parse_test(co):
from uncompyle6 import PYTHON_VERSION, IS_PYPY
ast = python_parser(PYTHON_VERSION, co, showasm=True, is_pypy=IS_PYPY)
print(ast)
return
# parse_test(parse_test.__code__)
parse_test(parse_test.func_code)

View File

@@ -0,0 +1,11 @@
"""Here we have parser grammars for the different Python versions.
Instead of full grammars, we have full grammars for certain Python versions
and the others indicate differences between a neighboring version.
For example Python 2.6, 2.7, 3.2, and 3.7 are largely "base" versions
which work off off parse2.py, parse3.py, and parse37base.py.
Some examples:
Python 3.3 diffs off of 3.2; 3.1 and 3.0 diff off of 3.2; Python 1.0..Python 2.5 diff off of
Python 2.6 and Python 3.8 diff off of 3.7
"""

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2015-2019 Rocky Bernstein
# Copyright (c) 2015-2020 Rocky Bernstein
# Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com>
#
# Copyright (c) 1999 John Aycock
@@ -25,6 +25,7 @@ If we succeed in creating a parse tree, then we have a Python program
that a later phase can turn into a sequence of ASCII text.
"""
from uncompyle6.parsers.reducecheck import (except_handler_else, ifelsestmt, tryelsestmt)
from uncompyle6.parser import PythonParser, PythonParserSingle, nop_func
from uncompyle6.parsers.treenode import SyntaxTree
from spark_parser import DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
@@ -144,10 +145,10 @@ class Python2Parser(PythonParser):
# Move to 2.7? 2.6 may use come_froms
tryelsestmtc ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
except_handler else_suitec COME_FROM
except_handler_else else_suitec COME_FROM
tryelsestmtl ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
except_handler else_suitel COME_FROM
except_handler_else else_suitel COME_FROM
try_except ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
except_handler COME_FROM
@@ -159,6 +160,8 @@ class Python2Parser(PythonParser):
except_handler ::= jmp_abs COME_FROM except_stmts
END_FINALLY
except_handler_else ::= except_handler
except_stmts ::= except_stmt+
except_stmt ::= except_cond1 except_suite
@@ -635,12 +638,23 @@ class Python2Parser(PythonParser):
self.addRule(rule, nop_func)
pass
self.reduce_check_table = {
# "and": and_check,
"except_handler_else": except_handler_else,
"ifelsestmt": ifelsestmt,
# "or": or_check,
"tryelsestmt": tryelsestmt,
"tryelsestmtl": tryelsestmt,
}
self.check_reduce["and"] = "AST"
self.check_reduce["except_handler_else"] = "tokens"
self.check_reduce["raise_stmt1"] = "tokens"
self.check_reduce["assert_expr_and"] = "AST"
self.check_reduce["tryelsestmt"] = "AST"
self.check_reduce["tryelsestmtl"] = "AST"
self.check_reduce["aug_assign2"] = "AST"
self.check_reduce["or"] = "AST"
self.check_reduce["ifstmt"] = "tokens"
# self.check_reduce['_stmts'] = 'AST'
# Dead code testing...
@@ -651,11 +665,40 @@ class Python2Parser(PythonParser):
if tokens is None:
return False
lhs = rule[0]
n = len(tokens)
fn = self.reduce_check_table.get(lhs, None)
if fn:
return fn(self, lhs, n, rule, ast, tokens, first, last)
if rule == ("and", ("expr", "jmp_false", "expr", "\\e_come_from_opt")):
# If the instruction after the instructions forming the "and" is an "YIELD_VALUE"
# then this is probably an "if" inside a comprehension.
if tokens[last] == "YIELD_VALUE":
# Note: We might also consider testing last+1 being "POP_TOP"
return True
# Test that jump_false jump somewhere beyond the end of the "and"
# it might not be exactly the end of the "and" because this and can
# be a part of a larger condition. Oddly in 2.7 there doesn't seem to be
# an optimization where the "and" jump_false is back to a loop.
jmp_false = ast[1]
if jmp_false[0] == "POP_JUMP_IF_FALSE":
while (first < last and isinstance(tokens[last].offset, str)):
last -= 1
if jmp_false[0].attr < tokens[last].offset:
return True
# Test that jmp_false jumps to the end of "and"
# or that it jumps to the same place as the end of "and"
jmp_false = ast[1][0]
jmp_target = jmp_false.offset + jmp_false.attr + 3
return not (jmp_target == tokens[last].offset or
tokens[last].pattr == jmp_false.pattr)
# Dead code testing...
# if lhs == 'while1elsestmt':
# from trepan.api import debug; debug()
if (
elif (
lhs in ("aug_assign1", "aug_assign2")
and ast[0]
and ast[0][0] in ("and", "or")
@@ -674,33 +717,6 @@ class Python2Parser(PythonParser):
elif lhs in ("delete_subscript", "del_expr"):
op = ast[0][0]
return op.kind in ("and", "or")
elif lhs in ("tryelsestmt", "tryelsestmtl"):
# Check the end of the except handler that there isn't a jump from
# inside the except handler to the end. If that happens
# then this is a "try" with no "else".
except_handler = ast[3]
if except_handler == "except_handler":
come_from = except_handler[-1]
# We only care about the *first* come_from because that is the
# the innermost one. So if the "tryelse" is invalid (should be a "try")
# ti will be invalid here.
if come_from == "COME_FROM":
first_come_from = except_handler[-1]
else:
assert come_from == "come_froms"
first_come_from = come_from[0]
leading_jump = except_handler[0]
# We really don't care that this is a jump per-se. But
# we could also check that this jumps to the end of the except if
# desired.
if isinstance(leading_jump, SyntaxTree):
except_handler_first_offset = leading_jump.first_child().off2int()
else:
except_handler_first_offset = leading_jump.off2int()
return first_come_from.attr > except_handler_first_offset
return False

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2016-2017 Rocky Bernstein
# Copyright (c) 2016-2017, 2020 Rocky Bernstein
# Copyright (c) 2000-2002 by hartmut Goebel <hartmut@goebel.noris.de>
from spark_parser import DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
@@ -19,9 +19,6 @@ class Python21Parser(Python22Parser):
for ::= SETUP_LOOP expr for_iter store
l_stmts_opt _jump_back
POP_BLOCK COME_FROM
expr ::= conditional
conditional ::= expr jmp_false expr JUMP_ABSOLUTE expr
"""
def p_import21(self, args):

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2016-2018 Rocky Bernstein
# Copyright (c) 2016-2018, 2020 Rocky Bernstein
"""
spark grammar differences over Python2.5 for Python 2.4.
"""
@@ -56,6 +56,12 @@ class Python24Parser(Python25Parser):
kv2 ::= DUP_TOP expr expr ROT_THREE STORE_SUBSCR
'''
def remove_rules_24(self):
self.remove_rules("""
expr ::= conditional
""")
def customize_grammar_rules(self, tokens, customize):
self.remove_rules("""
gen_comp_body ::= expr YIELD_VALUE POP_TOP
@@ -72,6 +78,7 @@ class Python24Parser(Python25Parser):
stmt ::= withasstmt
""")
super(Python24Parser, self).customize_grammar_rules(tokens, customize)
self.remove_rules_24()
if self.version == 2.4:
self.check_reduce['nop_stmt'] = 'tokens'

Some files were not shown because too many files have changed in this diff Show More