Compare commits

...

524 Commits

Author SHA1 Message Date
rocky
0a3f951682 Administrivia 2020-04-01 11:35:50 -04:00
rocky
7b4059820f Get ready for release 3.6.5 2020-04-01 11:18:20 -04:00
rocky
9caac7fc84 Small tweaks ...
* Remove unneeded Makefile
* sync n_ifelsesmt transform with decompyle3
2020-04-01 11:00:25 -04:00
rocky
ceb26d29fd 3.5- doesn't do format strings 2020-04-01 10:03:10 -04:00
rocky
9ec1c420e7 Merge branch 'master' of github.com:rocky/python-uncompyle6 2020-04-01 09:49:11 -04:00
rocky
a616e1e1c7 "withstmt" -> "with" and fix async for 2020-04-01 09:48:34 -04:00
rocky
b839abcfe7 run-and-email.sh seemed borked 2020-04-01 09:33:18 -04:00
rocky
e2d349f781 Handle nested async for in for...
and Better async comprehension detection.

Still more work is needed. See commented-out section in
test/simple_source/bug37/02_async_for_generator.py
2020-03-31 12:05:39 -04:00
rocky
af8add9df4 Bug in finding annotation in fn with docstring 2020-03-31 11:13:12 -04:00
rocky
3afc5a599a Fix one more call to ParseError 2020-03-31 10:46:00 -04:00
rocky
663bc06bb9 Fix one more call to ParseError 2020-03-31 10:44:52 -04:00
rocky
63d6054640 One more ParserError() upgrade 2020-03-31 10:29:52 -04:00
rocky
1c8805ecc9 Merge branch 'master' of github.com:rocky/python-uncompyle6 2020-03-31 10:14:27 -04:00
rocky
5fde4f2e05 Show token number in parser error listing...
But only if -g is given
2020-03-31 10:12:52 -04:00
rocky
b030a5ac2b pypy 3.6 7.3.0 tolerance...
more work is need on the tests though
2020-03-28 19:53:07 -04:00
rocky
01ea45a3f5 Administrivia - bump versions 2020-03-25 10:58:37 -04:00
rocky
2b2e7d3242 Bump xdis and pyenv versions, 2020-03-16 16:44:34 -04:00
rocky
2448f24764 Exclude a test on POWER7 2020-02-20 10:46:32 -05:00
rocky
299fd93125 One more excluded test 2020-02-16 21:55:47 -05:00
rocky
d9b2d66843 Runtests tweak 2020-02-16 19:53:03 -05:00
rocky
d070a28635 More run-and-email.sh tweaks 2020-02-16 18:26:21 -05:00
rocky
092874f8b5 Go over runtests.sh excludes 2020-02-16 17:49:56 -05:00
rocky
5a6a41a608 run-and-email tweaks 2020-02-16 17:35:57 -05:00
rocky
201635de7b run-and-email message tweak 2020-02-16 12:06:42 -05:00
rocky
81899a82c3 Allow inverted test names in "stdlib/runtests.sh" 2020-02-15 12:00:38 -05:00
rocky
76085a3040 Better runtsts BATCH variable handling 2020-02-15 09:26:45 -05:00
rocky
35127452f5 Bug found by 2.4 sre_parse.py testing 2020-02-15 08:06:58 -05:00
rocky
970cad7cc7 More 3.x runtests excludes 2020-02-15 06:01:57 -05:00
rocky
69064f4c23 runtests.sh exclude test_cmath.py in 3.x for now 2020-02-15 05:26:49 -05:00
rocky
28ef04d141 More bugs found via sre_parse.py decompilation 2020-02-15 05:10:11 -05:00
rocky
fd36c77d2d Bugs found in 2.4 branch testing 2020-02-14 10:54:37 -05:00
rocky
534afb3f6e run-and-email tweaks 2020-02-13 21:14:36 -05:00
rocky
874d196e5c 3.x ifelsestmtc reduction rule fix 2020-02-13 05:41:15 -05:00
rocky
dca2224520 Go over 3.3 and 3.4 runtest exclusions 2020-02-13 04:37:11 -05:00
rocky
e90455dcb8 transform ifelseif bugs 2020-02-13 04:31:16 -05:00
rocky
6dd97568f6 More information run-and-email.sh scripts...
Log status for each version.
2020-02-11 14:27:10 -05:00
rocky
aa6849a570 Add host to email on failure 2020-02-10 21:19:15 -05:00
rocky
749493631c cd not chdir for POSIX shell 2020-02-10 21:15:32 -05:00
rocky
7b3c91d23a Another 3.7 runtest exclude 2020-02-10 20:21:58 -05:00
rocky
bd0fdd0002 Start older-python testing 2020-02-10 18:24:33 -05:00
rocky
c62daaf0b7 3.5 exclusions 2020-02-10 18:07:35 -05:00
rocky
66d8526d7f Show host in subject; set BATCH explicitly 2020-02-10 17:38:50 -05:00
rocky
66db4cc862 2.7 runtest exclusion 2020-02-10 17:17:15 -05:00
rocky
bf288b1871 Fix bug introduced by ast "tranform" change 2020-02-10 16:13:57 -05:00
rocky
d2f6223e14 3.x exclusions 2020-02-10 12:35:24 -05:00
rocky
9d5a4c822e Runtests excludes 2020-02-10 12:09:25 -05:00
rocky
05e0a5661a runtest 3.6 excludes 2020-02-10 11:26:44 -05:00
rocky
76287162da Fix ifelif transformation for earlier Pythons 2020-02-10 11:16:32 -05:00
rocky
d64fa6ba50 3.6 runtests excludes 2020-02-10 10:59:03 -05:00
rocky
b76f7f905c 3.6 runtest exclude 2020-02-10 10:19:18 -05:00
rocky
c31384ef81 3.6 runtests exclusions 2020-02-10 09:40:33 -05:00
rocky
727dabff6a is_docsting needs to test for sstmts 2020-02-10 09:19:03 -05:00
rocky
946d74ad36 Fix bug in 3.0 name module detection 2020-02-10 08:58:48 -05:00
rocky
ebad4e2a9a Readme link typo 2020-02-09 13:36:53 -05:00
rocky
e342ef89e3 Get ready for release 3.6.4 2020-02-09 13:26:53 -05:00
rocky
57d59aa481 Update README.rst 2020-02-09 12:44:21 -05:00
rocky
6545d9a03b runtests excludes again 2020-02-09 09:42:38 -05:00
rocky
8ac35ad8ce Need to back off ifelsetesting on 2.7...
until we can more fully untangle if stmts in loops.
Current tests break urllib2.pyc and cgi.pyc
2020-02-09 09:01:32 -05:00
rocky
8836444be2 Correct ifelsestmtc rules for 3.x 2020-02-09 08:14:44 -05:00
rocky
339b4c56ee Typo 2020-02-09 07:38:32 -05:00
rocky
6cbb631aa6 In lambda code we, no stinking bogus yield 2020-02-09 07:32:06 -05:00
rocky
5355cb5404 async with rules back to 3.5 and ...
add precidence on cascaded "await" expressions
2020-02-08 20:31:06 -05:00
rocky
8495d208fb 3.7+ "async with" handling from decompyle3 2020-02-08 19:48:09 -05:00
rocky
e1758a8730 3.5 runtests exclusions 2020-02-08 15:50:12 -05:00
rocky
c1a825fbbb 3.6 runtests exclusions 2020-02-08 15:46:00 -05:00
rocky
8f2e408da2 Another 3.5 runtest exclusion 2020-02-08 15:25:42 -05:00
rocky
e2504c2421 3.7 ifelstmtl reduction rule checking 2020-02-08 13:47:05 -05:00
rocky
1d7085e5d2 Add 3.5 runtest exclusion 2020-02-08 12:07:35 -05:00
rocky
65707fa0f8 FIx bug that snuck in last commit. 2020-02-08 12:01:56 -05:00
rocky
b0931275a2 Need more precise "assert" for 3.8...
Add rule for ifelsestmtl which is needed in 3.8
2020-02-08 11:46:19 -05:00
rocky
7c73536b4a 3.6 "assert" and "or" handling bugs 2020-02-08 07:27:31 -05:00
rocky
946d46a574 Fix Python 3.6 "if" parse failures in loops...
This fixes all the pyenv parse errors that were introduced in the last refactor.
2020-02-08 05:21:42 -05:00
rocky
2b50cb56d7 One more 3.6 runtest exclude 2020-02-07 20:53:31 -05:00
rocky
6d5fb21363 Go over 3.2-3.6 runtests.sh exludes...
Reinstate a lot of tests broken since c90ff51
2020-02-07 20:09:40 -05:00
rocky
bd7d74fa5d 3.7 excludes again 2020-02-07 19:44:24 -05:00
rocky
c93a7a728b Add decompyle3 ifelsestmt reduction rule...
and Go over 3.3 and 3.7 runtests excludes
2020-02-07 19:22:23 -05:00
R. Bernstein
26a554c5c7 Merge pull request #306 from rocky/ifexp_from_conditional
if_exp from conditional
2020-02-07 18:26:12 -05:00
rocky
cb35ad906c One more if_exp use (ret_cond) 2020-02-07 16:34:48 -05:00
rocky
278af38df6 conditional -> if_exp ...
to match Python IfExp AST
2020-02-07 16:17:47 -05:00
rocky
7fb50918cd Bug in "async for" indentation 2020-02-06 23:54:03 -05:00
rocky
6525ade805 Comment tweaks 2020-02-06 20:37:40 -05:00
rocky
73951840b6 Correct last commit 2020-02-06 20:19:29 -05:00
rocky
3438e76865 "return locals()" change to track grammar change 2020-02-06 20:08:00 -05:00
rocky
7480af33d9 CircleCI again 2020-02-06 05:24:02 -05:00
rocky
88b2be70d2 CircleCI again 2020-02-06 05:22:48 -05:00
rocky
73de86728a CircleCI again 2020-02-06 05:21:45 -05:00
rocky
f743639bb6 CircleCI again 2020-02-06 05:20:02 -05:00
rocky
321c7906cd CircleCI again 2020-02-06 05:18:35 -05:00
rocky
06b281d1d8 Try to expand CircleCI testing 2020-02-06 05:14:29 -05:00
rocky
a99d8da0b4 Fix Recent CI bug 2020-02-06 05:10:57 -05:00
rocky
73e6409594 Fix recent CI bug 2020-02-06 05:09:17 -05:00
rocky
e93628d2dd Update CircleCI to test with 3.6.10 2020-02-06 05:04:39 -05:00
rocky
e41cd9be84 hide __qualname__ and name modules again...
due to recent grammar change
2020-02-06 03:19:56 -05:00
rocky
9166fb54a1 Adjust a couple of "assert"s 2020-02-04 22:06:48 -05:00
rocky
3120de0c02 Go over older 2.4 runtests failures 2020-02-04 22:01:49 -05:00
rocky
68c9de60a5 Adjust assert transform for new "if_and" rule 2020-02-04 21:28:08 -05:00
rocky
621bc96e8a Ensure offset is an int in offset test 2020-02-04 20:20:40 -05:00
rocky
6f4ec21ae2 __modname__ and __qualname__ detection...
since grammar has simplified.

May still need work for Python < 3.0
2020-02-02 19:09:50 -05:00
rocky
83e27bc427 Reinstate some 3.0 tests 2020-02-02 17:45:17 -05:00
rocky
9aae8f85c7 Bug introduced by last commit 2020-02-02 13:11:03 -05:00
rocky
04f8619cf1 Better docstring recognition 2020-02-02 13:02:37 -05:00
rocky
610994277c 2.7 ifelsestmt reduction rule futzing 2020-02-02 07:52:08 -05:00
rocky
6fff0fc5a2 More assert transform opportunities 2020-02-02 06:46:48 -05:00
rocky
e4a196278a More control-flow testing based on past failures...
Some of these still cause problems. Sigh.
2020-02-02 06:08:19 -05:00
rocky
6e5666c001 Merge branch 'master' of github.com:rocky/python-uncompyle6 2020-02-02 05:37:37 -05:00
rocky
38e2b8a10b Go over docstring handling 2020-02-02 05:37:07 -05:00
rocky
5d1bf2dd9b adjust "assert" transformation due to grammar ...
simplification
2020-02-01 22:27:17 -05:00
rocky
de1e7d423c A more correct offset2inst_index update. 2020-02-01 21:02:45 -05:00
rocky
16a51961c3 Add tests based on recent runtests.sh failures...
These run quicker and are distilled to simple examples.
2020-02-01 20:32:23 -05:00
rocky
0798078d7e See previous commit msg 2020-02-01 12:30:51 -05:00
rocky
db3c687784 See previous commit msg 2020-02-01 12:27:06 -05:00
rocky
0fafb38d35 Typo 2020-02-01 12:14:34 -05:00
rocky
f426101000 Another runtests.sh exclude for now 2020-02-01 12:11:51 -05:00
rocky
cf505545c0 3.6 iflastlstmt rule checking again 2020-02-01 12:00:08 -05:00
rocky
45c725feae 3.6 iflaststmtl doesn't follow ifstmt rules...
like iflaststmt does. test_dbm_dumb.py shows this
2020-02-01 11:20:58 -05:00
rocky
4dc64063d1 Small change 2020-02-01 11:14:19 -05:00
rocky
cdc5642715 More reduction checks...
Those in reduce check as well as those listed in parse{2,3}.

3.6 iflastsmtl needs ifstmt checking.
2020-02-01 07:10:30 -05:00
rocky
4f4850d9f7 Restrict "and" reduction checking to Python 3.6 2020-02-01 04:42:46 -05:00
rocky
451b18ee57 2.7 tryelse rule check disambiguation. 2020-02-01 04:05:50 -05:00
rocky
2d1ea6b02b See previous commit 2020-01-31 21:12:59 -05:00
rocky
f279cc2d70 ifelsesmt for 2.7 yet again 2020-01-31 21:10:24 -05:00
rocky
cb1b2a8759 Typo in last commit 2020-01-31 19:11:13 -05:00
rocky
d64158b299 No iflastlstmt reduce check for python < 3.6...
just yet
2020-01-31 19:07:28 -05:00
rocky
2ea8a2ef7f was getting testlastl reduce rule from wrong place 2020-01-31 17:37:47 -05:00
rocky
258fac3201 limit 3.x scope of ifelstmt reduction check to 3.6
at least for now. Again, we need major cleanup of this stuff, but that
will be done later.
2020-01-31 16:22:32 -05:00
rocky
7c012ebdfc Remove duplicate stmt 2020-01-31 15:50:46 -05:00
rocky
f27b72ab05 Work around 2.7 phony come-froms in ifelsesmt 2020-01-31 15:49:29 -05:00
rocky
be022b3416 Start ifelsestmt reduce checks in Python 2.7 2020-01-31 13:58:06 -05:00
rocky
41f1d1ec09 Remove dup statement 2020-01-31 13:18:23 -05:00
rocky
89c2805c27 Start to clean up parse3 reduction rule checks...
A lot more work is needed, but this is a start.
2020-01-31 13:10:35 -05:00
rocky
e639a30157 Add some decompyle reduction-check goodness here 2020-01-31 12:20:12 -05:00
rocky
ee2a1f62c6 runtests exclude found recently in 3.6 2020-01-31 04:46:25 -05:00
rocky
db46e096b4 See previous commit message 2020-01-31 03:53:35 -05:00
rocky
ea48944fff reinstate a test fixed recently 2020-01-31 03:08:36 -05:00
rocky
31714d3420 compile-file.py: preserve source file location 2020-01-30 21:09:34 -05:00
rocky
6466d30e2e Adjust "ifelsestmt" rule
Fixes #305
2020-01-30 19:45:32 -05:00
rocky
ef61f3a92a Add a 3.6 runtest exclude due to bad control flow 2020-01-30 18:02:44 -05:00
rocky
fdf4496a2d Track grammar "stmt" simplifications class ...
* NAME_MODULE constant
* QUAL_NAME constant
2020-01-29 15:37:58 -05:00
rocky
b548910e57 IMPORT_NAME -> IMPORT_NAME_ATTR
Fixes #304
2020-01-28 01:43:20 -05:00
R. Bernstein
c5f939e90d Merge pull request #302 from hjung4/spell
fix spelling errors
2020-01-27 20:33:01 -05:00
comet
6bbafcc8dd fix spelling errors 2020-01-27 18:41:55 -06:00
rocky
7fc4ccf75a Get ready for release 3.6.3 2020-01-26 12:11:22 -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
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
412a811ddb Go over 2.5 runtest exclusions 2020-01-21 07:15:47 -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
b8413d2c23 runtests 2.6 typo 2020-01-13 12:56:25 -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
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
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
14468fe8c9 Go over 2.5 for reduction rules and tests 2020-01-06 23:34:18 -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
444bab760b Update runtests.sh exception list 2020-01-05 21:25:34 -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
962c503133 Small typo 2020-01-05 18:57:04 -05:00
rocky
4f545c5bfa Get ready for release 3.6.2 2020-01-05 18:40:07 -05:00
rocky
bbfdb814bf Fix 3.4+ keyword-only parameter handling 2020-01-05 15:54:31 -05:00
rocky
d088e7ef11 Better 3.x if/else reduction rule checking 2020-01-05 13:27:50 -05:00
rocky
6646d18c7a More complex complex test 2020-01-05 11:54:41 -05:00
rocky
716e097654 kwonly args in lambas for 3.3..3.5 2020-01-05 11:17:33 -05:00
rocky
dba95c5200 3.7+ imports yet again 2020-01-05 00:13:53 -05:00
rocky
d5df411c7a 3.7+ multiple imports of dotted path 2020-01-03 23:22:28 -05:00
rocky
077f192711 Improve 3.7+ dotted imports 2020-01-03 21:22:55 -05:00
rocky
498df35a6c Update runtests.sh failures for 3.7 2020-01-03 09:31:11 -05:00
R. Bernstein
7e71ce3260 Merge pull request #301 from rocky/decompyle6-2020-merge
Decompyle6 2020 merge
2020-01-03 09:06:39 -05:00
rocky
825add1af7 3.7+ "if not" in list comprehension and other bug fixes 2020-01-03 09:01:48 -05:00
rocky
1a901bde8f remove unused rule found by grammar check. 2020-01-03 01:02:31 -05:00
rocky
732b5165c2 Fix a 3.7+ chained compare bug...
others remain though.
2020-01-03 00:55:45 -05:00
rocky
7bd81efe9b 3.7+ "from import" vs "import as" disambiguation 2020-01-02 09:43:37 -05:00
rocky
c42e16fafe Fix 3.7+ import as 2020-01-01 22:59:07 -05:00
rocky
6de57249ed Start 3.6+ var type annotations and decompyle3 merge...
Although overall an improvement, some new breakage
has occurred and should be fixed.
2020-01-01 01:42:00 -05:00
rocky
faf6ea9630 imports for 3.7+ again 2019-12-29 01:28:05 -05:00
rocky
566143b515 Python 3.7+ optimized if in comprehension 2019-12-28 18:09:00 -05:00
rocky
b2e1edb434 Fix Python 3.7+ "import as" but keep "import from" working 2019-12-28 11:09:31 -05:00
rocky
62c249d6b2 Simplify make_function3 by customization
We now have different routines for 3.6+
(and 2.x from before).

This is desirable before fixing 3.0..3.5 lambdas with default
paramerts and * args.
2019-12-27 13:02:59 -05:00
rocky
db2fdb30fd Tidy code.
* Don't use "str" as a variable name
* blacken helper and alphabetically order fns
* use helper function `find_code_node()` in transform `mk_func()`
2019-12-27 12:38:09 -05:00
rocky
37301ab49e Was dropping docstrings! Add in decompyle make_function36 2019-12-27 11:41:03 -05:00
rocky
97e3a7eb02 Split out make_function.py into v2 and v3 versions
A custom 3.3 make_function will be coming soon.
2019-12-27 03:32:15 -05:00
rocky
f98f7372c3 Administrivia 2019-12-24 12:52:32 -05:00
rocky
f88df747b8 Administrivial typo 2019-12-24 12:47:07 -05:00
rocky
6be3656ceb Get ready for release 3.6.1 2019-12-24 12:42:05 -05:00
rocky
8b48f62fc8 lambda *args with kwargs in 3.4 and 3.5 2019-12-23 20:51:03 -05:00
rocky
868721595d Fix grammar rule for "expr GET_ITER" in 3.1+ 2019-12-23 11:52:27 -05:00
rocky
9f270dce4a Go over full-version testing
When all versions, do less, but do the run tests. Overall overall
better.

Get rid of the tests that were the most problematic with hypothesis.
Hypothesis just doesn't run on enough versions and needs specific
versions for things we do use
2019-12-23 10:46:33 -05:00
rocky
bffbd0b352 3.6+ lambda params; add semantic rule customizing for lambdas 2019-12-23 07:19:40 -05:00
rocky
50fbea1a06 Python lambda *arg handling 2019-12-23 05:33:20 -05:00
rocky
ddffc2c078 blacken main.py 2019-12-23 04:44:40 -05:00
rocky
d9318e9bed Fix up better_repr tuple and list for singletions 2019-12-22 21:22:55 -05:00
rocky
c078048fb0 Fixes in 3.5+ lambdas break 3.3-. Deal with later. 2019-12-22 13:31:49 -05:00
rocky
6a82b1045e 3.x lambda * handling 2019-12-22 12:28:27 -05:00
rocky
3ea73cf977 Update list of stdlib failed tests 2019-12-22 09:05:40 -05:00
rocky
f3bec73840 Fix Bug in 3.6+ in call_ex_kw4 and call_kw36 2019-12-22 08:49:12 -05:00
rocky
8f4343ef22 Fix bug 3.5+ in handling nested decorators 2019-12-21 22:57:59 -05:00
rocky
d50834193c Update instructions 2019-12-20 10:36:01 -05:00
rocky
fa7ff89a32 Forgot to add this file in last commit 2019-12-19 06:50:01 -05:00
rocky
28d9e66a53 Redo the way we handle complex literals and 3.7+ bug fixes...
In 3.7+ remove assert_expr* parser rules
Fix "call" precidence in 3.7+ for it children
2019-12-19 06:40:13 -05:00
rocky
e39c6c7f0a Fix "with as" indenting and decorated "async def"
Misc other improvements: make check-short now is short
2019-12-18 09:14:09 -05:00
rocky
8470bded59 Bugs found in test_complex.py
list comprehensions from 3.x closures didn't handle nested for's
before 3.6.

Handle nanj and infj.
2019-12-17 18:27:43 -05:00
rocky
01b2b46757 Handle named parameters in 3.0..3.3 lambdas
What a pain. Thank you, Python!
2019-12-17 09:36:10 -05:00
rocky
aa398423a3 Add stripped-down test for lambda star bug 2019-12-16 16:42:11 -05:00
rocky
41bcf3387d Start to go add runtests exclusions for 3.3 2019-12-16 16:36:25 -05:00
rocky
89e7a0a246 ASYNC_GENERATOR -> 3.5+ "async def" 2019-12-16 13:44:33 -05:00
rocky
179fcafaba Fix indentation format in "async for" 2019-12-16 13:36:46 -05:00
rocky
e56a3c86d5 CircleCI woes 2019-12-16 14:25:46 -05:00
rocky
f527fdbdcd Bump xdis version to handle 3.6 code optimization flags 2019-12-16 13:47:55 -05:00
rocky
d39169dbda Add 3.7 async listcomp 2019-12-16 00:14:16 -05:00
rocky
996719688a Merge branch 'master' of github.com:rocky/python-uncompyle6 2019-12-15 21:18:44 -05:00
rocky
af9f6b05fa Add 3.7 "async for" in generator 2019-12-15 21:18:37 -05:00
rocky
39cbddccaf Include test for recent bug 2019-12-15 11:13:57 -05:00
rocky
75b3aaa86d Adminsitrivia: improve setup scripts 2019-12-15 10:56:29 -05:00
rocky
e93b70bcce Fix Python 3.x pringing superclasses...
class Description: not class Description("Description").
Introduced in not catching LOAD_CONST->LOAD_STR change
2019-12-15 10:49:24 -05:00
rocky
0eaeb82d48 Sync a little with decompyle3 2019-12-15 08:07:02 -05:00
rocky
0ae9612c7c Go over runtests.sh to make it more robust 2019-12-15 07:43:07 -05:00
rocky
09f232700e Remove duplicate 3.8async rules 2019-12-14 21:32:00 -05:00
rocky
bfde66c5e1 Extend "and" reduction-rule test to 2.4 2019-12-14 19:49:26 -05:00
rocky
4773ca4e5b Go over runtests.sh tests 2019-12-14 18:15:34 -05:00
rocky
62a3fcc9d5 Update runtests.sh output 2019-12-14 18:05:09 -05:00
rocky
bc7d7ddf12 Narrow what's excepted for iflastsmtl...
Disallow "if" jump to jump inside body of "then".
2019-12-14 17:23:37 -05:00
rocky
41b6e91286 More stringent transform test for assert 2019-12-14 11:31:13 -05:00
rocky
56bf3e3125 unary_expr -> unary_op 2019-12-14 10:57:19 -05:00
rocky
805ec7dbfc Add "if_not_and" rule similar to "if_not_or" rule. 2019-12-13 05:15:21 -05:00
rocky
668141662e unary_expr -> unary_op to match Python AST
former unary_op is now unary_operator
2019-12-11 15:47:46 -05:00
rocky
cc55fa1de1 binary_expr -> bin_op to match Python AST
I know binary_expr is more natural, but as with things Python we
sometimes sacrifice elegance and clarity for Python Fascism.
2019-12-11 13:35:21 -05:00
rocky
6f51f8910c Add 3.7+ "and" grammar rule and limit "or" more 2019-12-11 12:32:32 -05:00
rocky
bc614cf3fb Another 3.7+ "or" grammar rule 2019-12-11 07:32:35 -05:00
rocky
05f3dad32c Fix some 3.7+ "if"/"and" logic bugs 2019-12-11 06:56:43 -05:00
rocky
fb3761e4f3 Add another 3.8 try/finally rule and semantic action 2019-12-10 22:28:16 -05:00
rocky
9b2e22cbaf Small "not" bug in prior commit 2019-12-10 16:12:01 -05:00
rocky
cea2c7e1dc One more "assert" transform 2019-12-10 15:46:26 -05:00
rocky
79c38441b5 Better "assert" transformation. More 3.8 tests 2019-12-10 10:43:01 -05:00
rocky
3e3dd87c3b Get ready for release 3.6.0 2019-12-09 21:51:15 -05:00
rocky
edbbefb57d Start to remove crud in control-flow detection for 3.7+ 2019-12-09 18:28:57 -05:00
rocky
6546bbdaf9 Fix 2.x false tryelsestmtl detection...
With grammar reduction tests. Same as tryelsestmt. Lots of stdlib tests work
now. (More remain though.)
2019-12-09 16:19:10 -05:00
rocky
825ed3fef9 Reinstate some stdlib tests...
now that we distinguish try/else a little better
2019-12-09 14:13:30 -05:00
rocky
7d9c4ce8ca Better try/else detection 2019-12-09 14:04:57 -05:00
rocky
fdac1e3c46 Use 3.9-enabled xdis 2019-12-09 12:56:30 -05:00
rocky
daab1e8610 Start to tolerate 3.9 (in pydisassemble) 2019-12-09 12:20:00 -05:00
rocky
b8f4dca505 Update README.rsgt 2019-12-09 07:19:51 -05:00
rocky
99b8a99ffa Python 2.5 fixes..
* "with" handling.
* Go over 2.5 runtest.sh exclusions
2019-12-09 06:57:02 -05:00
rocky
8c879c02de Small logic correction in run-time test. 2019-12-09 04:09:44 -05:00
rocky
d11a9ea126 Remember rocky: use off2int() in offset testing! 2019-12-08 21:42:49 -05:00
rocky
4926474efc Add jump range check for 2.7 assert_expr_and 2019-12-08 21:37:45 -05:00
rocky
eba5226a04 Typos: decompyle3 -> uncompyle6 2019-12-08 18:05:37 -05:00
R. Bernstein
8d0ff367d8 Merge pull request #297 from rocky/decompile-merge
Merging in recent 3.7 and 3.8 improvements from decompyle6
2019-12-08 18:01:38 -05:00
rocky
c6ddefcef5 Merging in recent 3.7 and 3.8 improvements from decompyle6
This rebases 3.7, 3.8 ...decompilation off of 3.7ish rather than a 3.4
base.

Add more 3.7 and 3.8 tests
2019-12-08 17:54:59 -05:00
rocky
301464d646 Accomodate for optional docstring in function kw calculation 2019-12-02 12:58:26 -05:00
rocky
d5b52d44e0 Better bytecode detection for Python > 3.0...
Not perfect though. More work is needed on the xdis side.
2019-11-21 19:39:57 -05:00
rocky
322f491c83 Revise NEWS 2019-11-20 10:08:20 -05:00
rocky
2987d6a72b Go over some 3.0 and 3.1 tests 2019-11-18 22:46:27 -05:00
rocky
7609165967 Revise mixed expressions 2019-11-18 18:22:16 -05:00
rocky
655162a05e One more test 2019-11-18 18:15:30 -05:00
rocky
ca7f483dbb Better test coverage of operators (in 2.7 and 3.0) 2019-11-18 18:10:58 -05:00
rocky
e713169bdf Administrivia: go over tests...
Some tests were deferred and are not now
update Python 2.7 standard library tests
2019-11-18 12:30:48 -05:00
rocky
cc856e2b95 Refine 2.7 control flow reduction tests...
for "iflastsmtl" and "and"
2019-11-18 11:34:06 -05:00
rocky
d696443eb2 More 2.7 reduction checks for conditionals:
Specficially for "and" and "laststmtl"
2019-11-18 08:36:28 -05:00
rocky
a5e7eb19c6 Reinstate some tests 2019-11-18 06:59:27 -05:00
rocky
6659fffc0d Two Bugs ...
2.7: more stringent comparison and comp_if testing
2.6-2.7: fix botched dict constant translation
2019-11-18 06:49:36 -05:00
rocky
1868b566a1 RsT markup 2019-11-17 20:47:40 -05:00
rocky
791274c45d RsT markup 2019-11-17 20:47:13 -05:00
rocky
4327ee98e6 Update README for the current situation 2019-11-17 20:45:37 -05:00
rocky
2717a5e302 Administrivia 2019-11-17 20:26:35 -05:00
rocky
77dd3b8d50 Administrivia 2019-11-17 20:25:14 -05:00
rocky
2cfc60fbd7 Get ready for release 3.5.1 2019-11-17 19:59:26 -05:00
rocky
daa424cf0c Some grammar cleanup based on coverage info 2019-11-17 01:01:52 -05:00
rocky
7b68c9c838 Administriva - bump testing versions 2019-11-16 22:54:32 -05:00
rocky
df5df9364c Grammar debugging for 3.0, 3.7 and 3.8 2019-11-16 17:59:30 -05:00
rocky
f1496cad4d 3.0 return_if_stmt and...
* Some grammar cleanup
* add more grammar debugging
2019-11-16 17:32:48 -05:00
rocky
a3a15414d3 Add 3.0 whileTrue rule for recent CONTINUE change 2019-11-16 16:18:39 -05:00
rocky
9874553fb4 while1 rule adjustment for 3.0 2019-11-16 16:04:16 -05:00
rocky
d21d93fd84 Handle 3.0 call_stmt better 2019-11-16 15:21:59 -05:00
rocky
dbf2729f76 expand 3.0 "continue" detection 2019-11-16 12:23:09 -05:00
rocky
047e27c966 3.0 assert2...
Not like other 3.x due to the lack of POP_JUMP_IF
2019-11-16 09:10:14 -05:00
rocky
6a81a752a7 Adjust 3.0 iflastsmtl rule 2019-11-16 00:59:58 -05:00
rocky
44f0ba0efb Add 3.0 try/except rule 2019-11-15 23:39:36 -05:00
rocky
bc8907e752 Guard again improper assert transform...
we see this happen in getheader() from 3.0.1/lib/python3.0/http/client.pyc
2019-11-15 22:19:17 -05:00
rocky
4e9d8783d1 Add Python 3.0.1 list_comp rule 2019-11-15 21:32:31 -05:00
rocky
47c847644e Modify 3.0 _ifstmts_jump rule 2019-11-15 19:23:08 -05:00
rocky
af2ed31871 Add 3.0 whilestmt rule 2019-11-15 15:14:33 -05:00
rocky
49de5b5c9d add 3.0 iflaststmt rule 2019-11-15 14:07:37 -05:00
rocky
c8252ca9cb 3.0 import_from rule 2019-11-15 09:27:47 -05:00
rocky
0441fbc616 3.0.1 "ret_or", "ret_and", and "or" rules 2019-11-15 09:12:53 -05:00
rocky
1b4335edf1 Add 3.0.1 while loop rule 2019-11-15 07:48:23 -05:00
rocky
2e36551c02 Remove more 3.0 parse errors...
However this doesn't mean that some wrong rules still don't
kid in. We still have control-flow "if/and/else" vs "if/if/else" problems.
2019-11-14 18:32:52 -05:00
rocky
fff6f82dd7 expand 3.0 jump_except rule 2019-11-14 10:11:28 -05:00
rocky
7c8f3cc9ec Two 3.0 rules ...
- ifstmtlastl
- ifnotstmt30
2019-11-14 03:57:41 -05:00
rocky
78a595c8cf Bang on 3.0.1 control flow...
more word is needed though
2019-11-13 20:35:44 -05:00
rocky
cda0154594 Pypy 3.6.9 tolerance 2019-11-12 23:33:36 -05:00
rocky
d852f23962 3.3 "yield from" semantic action fix 2019-11-12 17:48:16 -05:00
rocky
065fd13b81 Small tweaks 2019-11-12 17:04:35 -05:00
rocky
659f37585b Bug in 3.0 rule in "jump_absolute_else" ...
and disallowing "else" to the wrong place.
2019-11-12 16:31:43 -05:00
rocky
bc18fcf7fa 3.0 tweak in iflastsmtl reduction validation 2019-11-12 06:37:43 -05:00
rocky
144f52da8e More 3.0 control flow pattern fixups 2019-11-12 06:08:30 -05:00
rocky
9f250b49ee Cope more JUMP/POP_IF not being in 3.0...
more is probably needed though.
2019-11-11 19:58:35 -05:00
rocky
4abdffecb9 More 3.0 control-flow rules...
Much more is needed though
2019-11-11 19:07:58 -05:00
rocky
1419acf019 More Python 3.0 for JUMP elimination ...
here, in except blocks.
2019-11-11 13:50:48 -05:00
rocky
bdc24d7f51 Add 3.0 gen_comp_body rule. 2019-11-11 05:10:54 -05:00
rocky
07ec8fa1fb More Python 3.0 custom "if" statment handling. 2019-11-10 18:44:43 -05:00
rocky
04c2240d63 Python 3.0 if/else handling 2019-11-10 17:23:33 -05:00
rocky
96dcdfd744 Last change but closer... 2019-11-10 16:09:17 -05:00
rocky
82ea77c592 Python 3.0 bytecode decoding 2019-11-10 15:56:04 -05:00
rocky
4f0e580438 Update testenv pypy 3.6 2019-11-10 13:44:52 -05:00
rocky
09cc0d775a Pypy 3.3 tolerance and ...
Remove some duplicate grammar rules
2019-11-10 13:34:51 -05:00
rocky
2da5a5649f Python 3.5 tolerance 2019-11-10 12:04:21 -05:00
rocky
373916f57c Pypy 3.5 tolerance 2019-11-09 21:56:36 -05:00
rocky
1c0c54991e Backend some buffers 2019-11-09 18:49:40 -05:00
rocky
5de5d2357f Update test_grammar for Python 3.8 2019-11-09 17:55:58 -05:00
rocky
6d296f11c9 Add another 3.8 test 2019-10-31 07:13:41 -04:00
rocky
0ae4acff9e Remove extraneous iter() in "for" of list comp...
Fixes #272
2019-10-30 21:58:14 -04:00
rocky
40c2f2962c Try expanding 3.8 testing 2019-10-30 19:36:42 -04:00
rocky
dae195e36e Expand 3.8 testing 2019-10-30 19:11:19 -04:00
rocky
2c503d5a14 Bump xdis ...
to handle pypy3.6 from Python 2
2019-10-30 11:58:39 -04:00
rocky
eed4c1025b Pypy 3.6 tolerance 2019-10-30 11:44:04 -04:00
rocky
86c1d12e69 Pypy 3.6 tolerance 2019-10-29 18:12:06 -04:00
rocky
61a367b0ae Don't test 3.8 except on 3.8 for now 2019-10-29 13:46:04 -04:00
rocky
dba6d24361 3.8 for block without a POP_BLOCK ...
and confusing JUMP_BACK for CONTINUE. Expect more like this.

Fixes #293
2019-10-29 13:32:43 -04:00
R. Bernstein
0b111f1568 Merge pull request #263 from rocky/pypy3.6
pypy3.6 handling
2019-10-29 12:55:30 -04:00
rocky
c666e2dc3d Remove pypy 3.6 testing for now 2019-10-29 12:08:00 -04:00
rocky
0a5fcc51d8 Pypy 3.6 fixes and tests 2019-10-29 11:43:09 -04:00
rocky
ade9f7a182 Add Pypy 3.6 file for showing unmarshal problem 2019-10-28 20:58:42 -04:00
rocky
d41ef3e5dc Pypy 3.6 tolerance 2019-10-28 14:46:45 -04:00
rocky
ebb0342b38 WIP pypy3.6 handling 2019-10-28 13:20:51 -04:00
rocky
f17ebf42a9 Administrative kinds of changes 2019-10-28 13:17:10 -04:00
rocky
85dcce4ff2 Add twine check in release process 2019-10-19 12:33:29 -04:00
rocky
bc9a16eaac Correct version number in NEWS.md 2019-10-12 20:10:29 -04:00
rocky
d08d183fc8 bytecode 1.6 test omission 2019-10-12 19:58:01 -04:00
rocky
0b3d6b8add Get ready for release 3.5.0 2019-10-12 19:53:17 -04:00
rocky
5cb46c2ed3 Better simpler fragment fix...
remove hide_internal test. We changed the default and that's what
whas causing RETURN_LAST to not get included.
2019-10-12 17:55:52 -04:00
rocky
163e47fb49 Fragment fixes (and workarounds)
fragments.py: add more parent offsets. blacken buffer
parser3.py: additional grammar rules for fragment parser

Misc small typos and corrections
2019-10-12 12:22:27 -04:00
rocky
0cf32f1b70 Better 1.5 parameter tuple handling...
Tidy README.rst
2019-10-10 17:20:00 -04:00
335 changed files with 13201 additions and 3451 deletions

View File

@@ -1,11 +1,3 @@
# This configuration was automatically generated from a CircleCI 1.0 config.
# It should include any build commands you had along with commands that CircleCI
# inferred from your project structure. We strongly recommend you read all the
# comments in this file to understand the structure of CircleCI 2.0, as the idiom
# for configuration has changed substantially in 2.0 to allow arbitrary jobs rather
# than the prescribed lifecycle of 1.0. In general, we recommend using this generated
# configuration as a reference rather than using it in production, though in most
# cases it should duplicate the execution of your original 1.0 config.
version: 2
jobs:
build:
@@ -18,18 +10,10 @@ jobs:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
COMPILE: --compile
# In CircleCI 1.0 we used a pre-configured image with a large number of languages and other packages.
# In CircleCI 2.0 you can now specify your own image, or use one of our pre-configured images.
# The following configuration line tells CircleCI to use the specified docker image as the runtime environment for you job.
# We have selected a pre-built image that mirrors the build environment we use on
# the 1.0 platform, but we recommend you choose an image more tailored to the needs
# of each job. For more information on choosing an image (or alternatively using a
# VM instead of a container) see https://circleci.com/docs/2.0/executor-types/
# To see the list of pre-built images that CircleCI provides for most common languages see
# https://circleci.com/docs/2.0/circleci-images/
machine:
python:
version: 2.7.14
docker:
- image: circleci/python:3.6.9
steps:
# Machine Setup
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
@@ -42,7 +26,7 @@ jobs:
# This is based on your 1.0 configuration file or project settings
- run:
working_directory: ~/rocky/python-uncompyle6
command: pip install virtualenv && pip install nose && pip install pep8 && pyenv rehash
command: pip install --user virtualenv && pip install --user nose && pip install --user pep8
# Dependencies
# This would typically go in either a build or a build-and-test job when using workflows
# Restore the dependency cache
@@ -53,9 +37,9 @@ jobs:
- v2-dependencies-
# This is based on your 1.0 configuration file or project settings
- run: pip install --upgrade setuptools
- run: pip install -e .
- run: pip install -r requirements-dev.txt
- run: pip install --user --upgrade setuptools
- run: pip install --user -e .
- run: pip install --user -r requirements-dev.txt
# Save dependency cache
- save_cache:
@@ -73,7 +57,7 @@ jobs:
# Test
# This would typically be a build job when using workflows, possibly combined with build
# This is based on your 1.0 configuration file or project settings
- run: python ./setup.py develop && make check-2.7
- run: sudo python ./setup.py develop && make check-3.6
- run: cd ./test/stdlib && bash ./runtests.sh 'test_[p-z]*.py'
# Teardown
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each

View File

@@ -11,7 +11,7 @@ Please remove any of the optional sections if they are not applicable.
Prerequisites
* Make sure the bytecode you have can be disassembled with a
disassembler.
disassembler and produces valid results.
* Don't put bytecode and corresponding source code on any service that
requires registration to download.
* When you open a bug report there is no privacy. If the legitimacy of
@@ -35,7 +35,7 @@ decompiler service for versions of Python up to 2.6.
## How to Reproduce
<!-- Please show both the input you gave and the
<!-- Please show both the *input* you gave and the
output you got in describing how to reproduce the bug:
or give a complete console log with input and output
@@ -63,7 +63,7 @@ can add that too.
Please modify for your setup
- Uncompyle6 version: output from `uncompyle6 --version` or `pip show uncompyle6`
- Python version: `python -V`
- Python version for the version of Python the byte-compiled the file: `python -c "import sys; print(sys.version)"` where `python` is the correct Cpython or Pypy binary.
- OS and Version: [e.g. Ubuntu bionic]
-->

1
.gitignore vendored
View File

@@ -6,6 +6,7 @@
/.eggs
/.hypothesis
/.idea
/.mypy_cache
/.pytest_cache
/.python-version
/.tox

View File

@@ -5,6 +5,7 @@ python:
- '2.7'
- '3.4'
- '3.6'
- '3.8'
matrix:
include:

View File

@@ -47,8 +47,12 @@ check-3.8:
# Skip for now
2.6 5.0 5.3 5.6 5.8:
#:PyPy pypy3-2.4.0 Python 3:
pypy-3.2 2.4:
#:PyPy pypy3-2.4.0 Python 3.6.1:
7.1 pypy-3.2 2.4:
$(MAKE) -C test $@
#:PyPy pypy3-2.4.0 Python 3.6.9:
7.2:
$(MAKE) -C test $@
#: Run py.test tests

211
NEWS.md
View File

@@ -1,11 +1,213 @@
3.6.5: 2020-4-1 April Fool
==========================
Back port some of the changes in decompile3 here which mostly helps 3.7 and 3.8 decompilation, although this may also help 3.6ish versions too.
- Handle nested `async for in for...` and Better async comprehension detection via `xdis`. Still more work is needed.
- include token number in listings when `-g` and there is a parser error
- remove unneded `Makefile`s now that remake 4.3+1.5dbg is a thing that has `-c`
- Bug in finding annotations in functions with docstrings
- Fix bug found by 2.4 sre_parse.py testing
- Fix `transform` module's `ifelseif` bugs
- Fix bug in 3.0 name module detection
- Fix docstring detection
3.6.4: 2020-2-9 Plateau
=======================
The main focus in this release was fix some of the more glaring problems creapt in from the last release due to that refactor.
`uncompyle6` code is at a plateau where what is most needed is a code refactoring. In doing this, until everything refactored and replaced, decomplation may get worse.
Therefore, this release largely serves as a checkpoint before more major upheaval.
The upheaval, in started last release, I believe the pinnicle was around c90ff51 which wasn't a release. I suppose I should tag that.
After c90ff5, I started down the road of redoing control flow in a more comprehensible, debuggable, and scalable way. See [The Control Flow Mess](https://github.com/rocky/python-uncompyle6/wiki/The-Control-Flow-Mess)
The bulk of the refactoring going on in the [decompyle3](https://github.com/rocky/python-decompil3) project, but I try to trickle down the changes.
It is tricky because the changes are large and I have to figure decompose things so that little testable pieces can be done. And there is also the problem that what is in decompyle3 is incomplete as well.
Other than control flow, another change that will probably happen in the next release is to redo the grammar for lambda expressions. Right now, we treat them as Python statements, you know, things with compound statements in them. But lambda aren't that. And so there is hackery to paper over difference making a statement out of an expression the wrong thing to do. For example, a return of an "and" expression can be expressed as nested "if" statements with return inside them, but the "if" variant of the bytecode is not valid in a lambda.
In the decompyle3 code, I've gone down the road making the grammar goal symbol be an expression. This also offers the opportunity to split the grammar making parsing inside lambda not only more reliable because the wrong choices don't exist, but also simpler and faster because all those rules just need don't need to exist in parsing.
I cringe in thinking about how the code has lived for so long without noticing such a simple stupidity, and lapse of sufficient thought.
Some stats from testing. The below give numbers of decompiled tests from Python's test suite which succesfully ran
```
Version test-suites passing
------- -------------------
2.4.6 243
2.5.6 265
2.6.9 305
3.3.7 300
3.4.10 304
3.5.9 260
3.6.10 236
3.7.6 306
3.8.1 114
```
Decompiled bytecode files distributed with Python (syntax check only):
```
2.7.17 647 files: 0 failed
3.2.6 900 files: 0 failed
3.3.7 1256 files: 0 failed
3.4.10 800 files: 0 failed
3.5.9 900 files: 0 failed
3.6.10 1300 files: 28 failed
```
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
======================
Yet again the focus has been on just fixing bugs, mostly geared in the
later 3.x range. To get some sense what sill needs fixing, consult
test/stdlib/runtests.sh. And that only has a portion of what's known.
`make_function.py` has gotten so complex that it was split out into 3 parts
to handle different version ranges: Python <3, Python 3.0..3.6 and Python 3.7+.
An important fix is that we had been dropping docstrings in Python 3 code as a result
of a incomplete merge from the decompile3 base with respect to the transform phase.
Also important (at least to me) is that we can now handle 3.6+
variable type annotations. Some of the decompile3 code uses that in
its source code, and I now use variable annotations in conjunction
with mypy in some of my other Python projects
Code generation for imports, especially where the import is dotted
changed a bit in 3.7; with this release are just now tracking that
change better. For this I've added pseudo instruction
`IMPORT_NAME_ATTR`, derived from the `IMPORT_NAME` instruction, to
indicate when an import contains a dotted import. Similarly, code for
3.7 `import .. as ` is basically the same as `from .. import`, the
only difference is the target of the name changes to an "alias" in the
former. As a result, the disambiguation is now done on the semantic
action side, rathero than in parsing grammar rules.
Some small specific fixes:
* 3.7+ some chained compare parsing has been fixed. Other remain.
* better if/else rule checking in the 3.4 and below range.
* 3.4+ keyword-only parameter handling was fixed more generally
* 3.3 .. 3.5 keyword-only parameter args in lambda was fixed
3.6.1: 2019-12-10 Christmas Hannukah
====================================
Overall, as in the past, the focus has been on just fixing bugs, more geared
in the later 3.x range. Handling "async for/with" in 3.8+ works better.
Numerous bugs around handling `lambda` with keyword-only and `*` args in the
3.0-3.8 have been fixed. However many still remain.
`binary_expr` and `unary_expr` have been renamed to `bin_op` and
`unary_op` to better correspond the Python AST names.
Some work was done Python 3.7+ to handle `and` better; less was done
along the lines of handling `or`. Much more is needed to improve
parsing stability of 3.7+. More of what was done with `and` needs to
be done with `or` and this will happen first in the "decompyle3"
project.
Later this will probably be extended backwards to handle the 3.6-
versions better. This however comes with a big decompilation speed
penalty. When we redo control flow this should go back to normal, but
for now, accuracy is more important than speed.
Another `assert` transform rule was added. Parser rules to distingish
`try/finally` in 3.8 were added and we are more stringent about what
can be turned into an `assert`. There was some grammar cleanup here
too.
A number of small bugs were fixed, and some administrative changes to
make `make check-short` really be short, but check more throughly what
it checks. minimum xdis version needed was bumped to include in the
newer 3.6-3.9 releases. See the `ChangeLog` for details.
3.6.0: 2019-12-10 gecko gecko
=============================
The main focus in this release was more accurate decompilation especially
for 3.7 and 3.8. However there are some improvments to Python 2.x as well,
including one of the long-standing problems of detecting the difference between
`try ... ` and `try else ...`.
With this release we now rebase Python 3.7 on off of a 3.7 base; This
is also as it is (now) in decompyle3. This facilitates removing some of the
cruft in control-flow detection in the 2.7 uncompyle2 base.
Alas, decompilation speed for 3.7 on is greatly increased. Hopefull
this is temporary (cough, cough) until we can do a static control flow
pass.
Finally, runing in 3.9-dev is tolerated. We can disassemble, but no parse tables yet.
3.5.1 2019-11-17 JNC
====================
- Pypy 3.3, 3.5, 3.6, and 3.6.9 support
- bump xdis version to handle newer Python releases, e.g. 2.7.17, 3.5.8, and 3.5.9
- Improve 3.0 decompilation
- no parse errors on stlib bytecode. However accurate translation in
control-flow and and/or detection needs work
- Remove extraneous iter() in "for" of list comprehension Fixes #272
- "for" block without a `POP_BLOCK `and confusing `JUMP_BACK` for `CONTINUE`. Fixes #293
- Fix unmarshal incompletness detected in Pypy 3.6
- Miscellaneous bugs fixed
3.5.0 2019-10-12 Stony Brook Ride
=================================
- Fix fragment bugs
* missing `RETURN_LAST` introduced when adding transformation layer
* more parent entries on tokens
- Preliminary support for decompiling Python 1.0, 1.1, 1.2, and 1.6
* Newer _xdis_ version needed
3.4.1 2019-10-02
================
- Correct assert{,2} transforms Fixes #289
- Fragment parsing fixes:
* Wasn't handling 3-arg %p
* fielding error in code_deparse()
- Use newer xdis to better track Python 3.8.0
* Wasn't handling 3-arg `%p`
* fielding error in `code_deparse()`
- Use newer _xdis_ to better track Python 3.8.0
3.4.0 2019-08-24 Totoro
@@ -115,8 +317,7 @@ Lots of decomplation bugs, especially in the 3.x series fixed. Don't worry thoug
3.3.0 2019-04-14 Holy Week
==========================
* First cut at Python 3.8 (many bugs remain)
* Reinstate -c | --compile (compile before disassembly) option
* First cut at Python 3.8 (many bug remain)
* The usual smattering of bug and doc fixes
3.2.6 2019-03-23 Mueller Report

View File

@@ -1,7 +1,5 @@
|buildstatus| |Pypi Installs| |Latest Version| |Supported Python Versions|
|packagestatus|
uncompyle6
@@ -15,9 +13,9 @@ Introduction
------------
*uncompyle6* translates Python bytecode back into equivalent Python
source code. It accepts bytecodes from Python version 1.3 to version
source code. It accepts bytecodes from Python version 1.0 to version
3.8, spanning over 24 years of Python releases. We include Dropbox's
Python 2.5 bytecode and some PyPy bytecode.
Python 2.5 bytecode and some PyPy bytecodes.
Why this?
---------
@@ -48,14 +46,15 @@ not exist and there is just bytecode. Again, my debuggers make use of
this.
There were (and still are) a number of decompyle, uncompyle,
uncompyle2, uncompyle3 forks around. Almost all of them come basically
from the same code base, and (almost?) all of them are no longer
actively maintained. One was really good at decompiling Python 1.5-2.3
or so, another really good at Python 2.7, but that only. Another
handles Python 3.2 only; another patched that and handled only 3.3.
You get the idea. This code pulls all of these forks together and
*moves forward*. There is some serious refactoring and cleanup in this
code base over those old forks.
uncompyle2, uncompyle3 forks around. Many of them come basically from
the same code base, and (almost?) all of them are no longer actively
maintained. One was really good at decompiling Python 1.5-2.3, another
really good at Python 2.7, but that only. Another handles Python 3.2
only; another patched that and handled only 3.3. You get the
idea. This code pulls all of these forks together and *moves
forward*. There is some serious refactoring and cleanup in this code
base over those old forks. Even more experimental refactoring is going
on in decompyle3_.
This demonstrably does the best in decompiling Python across all
Python versions. And even when there is another project that only
@@ -77,11 +76,11 @@ fixed in the other decompilers.
Requirements
------------
The code here can be run on Python versions 2.6 or later, PyPy 3-2.4,
or PyPy-5.0.1. Python versions 2.4-2.7 are supported in the
python-2.4 branch. The bytecode files it can read have been tested on
Python bytecodes from versions 1.4, 2.1-2.7, and 3.0-3.8 and the
above-mentioned PyPy versions.
The code here can be run on Python versions 2.6 or later, PyPy 3-2.4
and later. Python versions 2.4-2.7 are supported in the python-2.4
branch. The bytecode files it can read have been tested on Python
bytecodes from versions 1.4, 2.1-2.7, and 3.0-3.8 and later PyPy
versions.
Installation
------------
@@ -90,9 +89,9 @@ This uses setup.py, so it follows the standard Python routine:
::
pip install -e . # set up to run from source tree
# Or if you want to install instead
python setup.py install # may need sudo
$ pip install -e . # set up to run from source tree
# Or if you want to install instead
$ python setup.py install # may need sudo
A GNU makefile is also provided so :code:`make install` (possibly as root or
sudo) will do the steps above.
@@ -141,9 +140,16 @@ Python syntax changes, you should use this option if the bytecode is
the right bytecode for the Python interpreter that will be checking
the syntax.
You can also cross compare the results with another python decompiler
like pycdc_ . Since they work differently, bugs here often aren't in
that, and vice versa.
You can also cross compare the results with either another version of
`uncompyle6` since there are are sometimes regressions in decompiling
specific bytecode as the overall quality improves.
For Python 3.7 and above, the code in decompyle3_ is generally
better.
Or try specific another python decompiler like uncompyle2_, unpyc37_,
or pycdc_. Since the later two work differently, bugs here often
aren't in that, and vice versa.
There is an interesting class of these programs that is readily
available give stronger verification: those programs that when run
@@ -188,15 +194,21 @@ they had been rare. Perhaps to compensate for the additional
added. So in sum handling control flow by ad hoc means as is currently
done is worse.
Between Python 3.5, 3.6 and 3.7 there have been major changes to the
:code:`MAKE_FUNCTION` and :code:`CALL_FUNCTION` instructions.
Between Python 3.5, 3.6, 3.7 there have been major changes to the
:code:`MAKE_FUNCTION` and :code:`CALL_FUNCTION` instructions. Python
Python 3.8 removes :code:`SETUP_LOOP`, :code:`SETUP_EXCEPT`,
:code:`BREAK_LOOP`, and :code:`CONTINUE_LOOP`, instructions which may
make control-flow detection harder, lacking the more sophisticated
control-flow analysis that is planned. We'll see.
Currently not all Python magic numbers are supported. Specifically in
some versions of Python, notably Python 3.6, the magic number has
changes several times within a version.
**We support only released versions, not candidate versions.** Note however
that the magic of a released version is usually the same as the *last* candidate version prior to release.
**We support only released versions, not candidate versions.** Note
however that the magic of a released version is usually the same as
the *last* candidate version prior to release.
There are also customized Python interpreters, notably Dropbox,
which use their own magic and encrypt bytcode. With the exception of
@@ -218,7 +230,7 @@ There is lots to do, so please dig in and help.
See Also
--------
* https://github.com/zrax/pycdc : purports to support all versions of Python. It is written in C++ and is most accurate for Python versions around 2.7 and 3.3 when the code was more actively developed. Accuracy for more recent versions of Python 3 and early versions of Python are especially lacking. See its `issue tracker <https://github.com/zrax/pycdc/issues>`_ for details. Currently lightly maintained.
* https://github.com/rocky/python-decompile3 : Much smaller and more modern code, focusing on 3.7+. Changes in that will get migrated back ehre.
* https://code.google.com/archive/p/unpyc3/ : supports Python 3.2 only. The above projects use a different decompiling technique than what is used here. Currently unmaintained.
* https://github.com/figment/unpyc3/ : fork of above, but supports Python 3.3 only. Includes some fixes like supporting function annotations. Currently unmaintained.
* https://github.com/wibiti/uncompyle2 : supports Python 2.7 only, but does that fairly well. There are situations where :code:`uncompyle6` results are incorrect while :code:`uncompyle2` results are not, but more often uncompyle6 is correct when uncompyle2 is not. Because :code:`uncompyle6` adheres to accuracy over idiomatic Python, :code:`uncompyle2` can produce more natural-looking code when it is correct. Currently :code:`uncompyle2` is lightly maintained. See its issue `tracker <https://github.com/wibiti/uncompyle2/issues>`_ for more details
@@ -227,6 +239,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 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
@@ -235,6 +248,9 @@ See Also
.. _debuggers: https://pypi.python.org/pypi/trepan3k
.. _remake: https://bashdb.sf.net/remake
.. _pycdc: https://github.com/zrax/pycdc
.. _decompyle3: https://github.com/rocky/python-decompile3
.. _uncompyle2: https://github.com/wibiti/uncompyle2
.. _unpyc37: https://github.com/andrew-tavera/unpyc37
.. _this: https://github.com/rocky/python-uncompyle6/wiki/Deparsing-technology-and-its-use-in-exact-location-reporting
.. |buildstatus| image:: https://travis-ci.org/rocky/python-uncompyle6.svg
:target: https://travis-ci.org/rocky/python-uncompyle6

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",
@@ -58,7 +58,7 @@ entry_points = {
]}
ftp_url = None
install_requires = ["spark-parser >= 1.8.9, < 1.9.0",
"xdis >= 4.0.4, < 4.1.0"]
"xdis >= 4.2.4, < 4.3.0"]
license = "GPL3"
mailing_list = "python-debugger@googlegroups.com"

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

@@ -21,8 +21,9 @@ for version in $PYVERSIONS; do
exit $?
fi
make clean && pip install -e .
if ! make check; then
if ! make check-short; then
exit $?
fi
echo === $version ===
done
make check

View File

@@ -55,20 +55,24 @@
# Make packages and tag
$ . ./admin-tools/make-dist-older.sh
$ pyenv local 3.8.2
$ twine check dist/uncompyle6-$VERSION*
$ git tag release-python-2.4-$VERSION
$ twine check dist/uncompyle6-$VERSION*
$ . ./admin-tools/make-dist-newer.sh
Goto https://github.com/rocky/python-uncompyle6/releases
$ twine check dist/uncompyle6-$VERSION*
# Upload single package and look at Rst Formating
$ twine check dist/uncompyle6-${VERSION}*
$ twine upload dist/uncompyle6-${VERSION}-py3.3.egg
# Upload rest of versions
$ twine upload dist/uncompyle6-${VERSION}*
Goto https://github.com/rocky/python-uncompyle6/releases
# Push tags:
$ git push --tags

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.6.9 3.7.4 2.6.9 3.3.7 2.7.16 3.2.6 3.1.5 3.4.10 3.5.7'
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.7 3.8.2'

View File

@@ -1,5 +1,5 @@
#!/bin/bash
PYTHON_VERSION=3.6.8
PYTHON_VERSION=3.7.7
# FIXME put some of the below in a common routine
function finish {
@@ -20,3 +20,4 @@ cd $fulldir/..
(cd ../python-xdis && git checkout master && pyenv local $PYTHON_VERSION) && git pull && \
git checkout master && pyenv local $PYTHON_VERSION && git pull
cd $owd
rm -v */.python-version || true

View File

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

View File

@@ -1,7 +1,11 @@
PHONY=check test pytest
SHELL=/bin/bash
PYTHON ?= python
#: Run all tests
test check pytest:
py.test
@PYTHON_VERSION=`$(PYTHON) -V 2>&1 | cut -d ' ' -f 2 | cut -d'.' -f1,2`; \
if [[ $$PYTHON_VERSION > 3.2 ]] || [[ $$PYTHON_VERSION == 2.7 ]] || [[ $$PYTHON_VERSION == 2.6 ]]; then \
py.test; \
fi

View File

@@ -1,158 +0,0 @@
# std
# test
import sys
from uncompyle6 import PYTHON_VERSION, code_deparse
import pytest
pytestmark = pytest.mark.skipif(
PYTHON_VERSION <= 2.6, reason="hypothesis needs 2.7 or later"
)
if PYTHON_VERSION > 2.6:
import hypothesis
from hypothesis import strategies as st
# uncompyle6
@st.composite
def expressions(draw):
# todo : would be nice to generate expressions using hypothesis however
# this is pretty involved so for now just use a corpus of expressions
# from which to select.
return draw(
st.sampled_from(
(
"abc",
"len(items)",
"x + 1",
"lineno",
"container",
"self.attribute",
"self.method()",
# These expressions are failing, I think these are control
# flow problems rather than problems with FORMAT_VALUE,
# however I need to confirm this...
#'sorted(items, key=lambda x: x.name)',
#'func(*args, **kwargs)',
#'text or default',
#'43 if life_the_universe and everything else None'
)
)
)
@st.composite
def format_specifiers(draw):
"""
Generate a valid format specifier using the rules:
format_spec ::= [[fill]align][sign][#][0][width][,][.precision][type]
fill ::= <any character>
align ::= "<" | ">" | "=" | "^"
sign ::= "+" | "-" | " "
width ::= integer
precision ::= integer
type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"
See https://docs.python.org/2/library/string.html
:param draw: Let hypothesis draw from other strategies.
:return: An example format_specifier.
"""
alphabet_strategy = st.characters(
min_codepoint=ord("a"), max_codepoint=ord("z")
)
fill = draw(st.one_of(alphabet_strategy, st.none()))
align = draw(st.sampled_from(list("<>=^")))
fill_align = (fill + align or "") if fill else ""
type_ = draw(st.sampled_from("bcdeEfFgGnosxX%"))
can_have_sign = type_ in "deEfFgGnoxX%"
can_have_comma = type_ in "deEfFgG%"
can_have_precision = type_ in "fFgG"
can_have_pound = type_ in "boxX%"
can_have_zero = type_ in "oxX"
sign = draw(st.sampled_from(list("+- ") + [""])) if can_have_sign else ""
pound = draw(st.sampled_from(("#", ""))) if can_have_pound else ""
zero = draw(st.sampled_from(("0", ""))) if can_have_zero else ""
int_strategy = st.integers(min_value=1, max_value=1000)
width = draw(st.one_of(int_strategy, st.none()))
width = str(width) if width is not None else ""
comma = draw(st.sampled_from((",", ""))) if can_have_comma else ""
if can_have_precision:
precision = draw(st.one_of(int_strategy, st.none()))
precision = "." + str(precision) if precision else ""
else:
precision = ""
return "".join((fill_align, sign, pound, zero, width, comma, precision, type_))
@st.composite
def fstrings(draw):
"""
Generate a valid f-string.
See https://www.python.org/dev/peps/pep-0498/#specification
:param draw: Let hypothsis draw from other strategies.
:return: A valid f-string.
"""
character_strategy = st.characters(
blacklist_characters="\r\n'\\s{}", min_codepoint=1, max_codepoint=1000
)
is_raw = draw(st.booleans())
integer_strategy = st.integers(min_value=0, max_value=3)
expression_count = draw(integer_strategy)
content = []
for _ in range(expression_count):
expression = draw(expressions())
conversion = draw(st.sampled_from(("", "!s", "!r", "!a")))
has_specifier = draw(st.booleans())
specifier = ":" + draw(format_specifiers()) if has_specifier else ""
content.append("{{{}{}}}".format(expression, conversion, specifier))
content.append(draw(st.text(character_strategy)))
content = "".join(content)
return "f{}'{}'".format("r" if is_raw else "", content)
@pytest.mark.skipif(PYTHON_VERSION != 3.6, reason="need Python 3.6")
@hypothesis.given(format_specifiers())
def test_format_specifiers(format_specifier):
"""Verify that format_specifiers generates valid specifiers"""
try:
exec('"{:' + format_specifier + '}".format(0)')
except ValueError as e:
if "Unknown format code" not in str(e):
raise
def run_test(text):
hypothesis.assume(len(text))
hypothesis.assume("f'{" in text)
expr = text + "\n"
code = compile(expr, "<string>", "single")
deparsed = code_deparse(code, sys.stdout, PYTHON_VERSION, compile_mode="single")
recompiled = compile(deparsed.text, "<string>", "single")
if recompiled != code:
print(recompiled)
print("================")
print(code)
print("----------------")
assert (
"dis(" + deparsed.text.strip("\n") + ")"
== "dis(" + expr.strip("\n") + ")"
)
@pytest.mark.skipif(PYTHON_VERSION != 3.6, reason="need Python 3.6")
@hypothesis.given(fstrings())
def test_uncompyle_fstring(fstring):
"""Verify uncompyling fstring bytecode"""
run_test(fstring)
@pytest.mark.skipif(PYTHON_VERSION != 3.6, reason="need Python 3.6+")
@pytest.mark.parametrize("fstring", ["f'{abc}{abc!s}'", "f'{abc}0'"])
def test_uncompyle_direct(fstring):
"""useful for debugging"""
run_test(fstring)

View File

@@ -1,185 +0,0 @@
import string
from uncompyle6 import PYTHON_VERSION
import pytest
pytestmark = pytest.mark.skip(PYTHON_VERSION < 2.7,
reason="need at least Python 2.7")
if PYTHON_VERSION > 2.6:
from hypothesis import given, assume, example, settings, strategies as st
from validate import validate_uncompyle
from test_fstring import expressions
alpha = st.sampled_from(string.ascii_lowercase)
numbers = st.sampled_from(string.digits)
alphanum = st.sampled_from(string.ascii_lowercase + string.digits)
@st.composite
def function_calls(draw,
min_keyword_args=0, max_keyword_args=5,
min_positional_args=0, max_positional_args=5,
min_star_args=0, max_star_args=1,
min_double_star_args=0, max_double_star_args=1):
"""
Strategy factory for generating function calls.
:param draw: Callable which draws examples from other strategies.
:return: The function call text.
"""
st_positional_args = st.lists(
alpha,
min_size=min_positional_args,
max_size=max_positional_args
)
st_keyword_args = st.lists(
alpha,
min_size=min_keyword_args,
max_size=max_keyword_args
)
st_star_args = st.lists(
alpha,
min_size=min_star_args,
max_size=max_star_args
)
st_double_star_args = st.lists(
alpha,
min_size=min_double_star_args,
max_size=max_double_star_args
)
positional_args = draw(st_positional_args)
keyword_args = draw(st_keyword_args)
st_values = st.lists(
expressions(),
min_size=len(keyword_args),
max_size=len(keyword_args)
)
keyword_args = [
x + '=' + e
for x, e in
zip(keyword_args, draw(st_values))
]
star_args = ['*' + x for x in draw(st_star_args)]
double_star_args = ['**' + x for x in draw(st_double_star_args)]
arguments = positional_args + keyword_args + star_args + double_star_args
draw(st.randoms()).shuffle(arguments)
arguments = ','.join(arguments)
function_call = 'fn({arguments})'.format(arguments=arguments)
try:
# TODO: Figure out the exact rules for ordering of positional, keyword,
# star args, double star args and in which versions the various
# types of arguments are supported so we don't need to check that the
# expression compiles like this.
compile(function_call, '<string>', 'single')
except:
assume(False)
return function_call
def test_function_no_args():
validate_uncompyle("fn()")
@pytest.mark.skipif(PYTHON_VERSION < 2.7,
reason="need at least Python 2.7")
def isolated_function_calls(which):
"""
Returns a strategy for generating function calls, but isolated to
particular types of arguments, for example only positional arguments.
This can help reason about debugging errors in specific types of function
calls.
:param which: One of 'keyword', 'positional', 'star', 'double_star'
:return: Strategy for generating an function call isolated to specific
argument types.
"""
kwargs = dict(
max_keyword_args=0,
max_positional_args=0,
max_star_args=0,
max_double_star_args=0,
)
kwargs['_'.join(('min', which, 'args'))] = 1
kwargs['_'.join(('max', which, 'args'))] = 5 if 'star' not in which else 1
return function_calls(**kwargs)
with settings(max_examples=25):
@pytest.mark.skipif(PYTHON_VERSION < 2.7,
reason="need at least Python 2.7")
@given(isolated_function_calls('positional'))
@example("fn(0)")
def test_function_positional_only(expr):
validate_uncompyle(expr)
@pytest.mark.skipif(PYTHON_VERSION < 2.7,
reason="need at least Python 2.7")
@given(isolated_function_calls('keyword'))
@example("fn(a=0)")
def test_function_call_keyword_only(expr):
validate_uncompyle(expr)
@pytest.mark.skipif(PYTHON_VERSION < 2.7,
reason="need at least Python 2.7")
@given(isolated_function_calls('star'))
@example("fn(*items)")
def test_function_call_star_only(expr):
validate_uncompyle(expr)
@pytest.mark.skipif(PYTHON_VERSION < 2.7,
reason="need at least Python 2.7")
@given(isolated_function_calls('double_star'))
@example("fn(**{})")
def test_function_call_double_star_only(expr):
validate_uncompyle(expr)
@pytest.mark.xfail()
def test_BUILD_CONST_KEY_MAP_BUILD_MAP_UNPACK_WITH_CALL_BUILD_TUPLE_CALL_FUNCTION_EX():
validate_uncompyle("fn(w=0,m=0,**v)")
@pytest.mark.xfail()
def test_BUILD_MAP_BUILD_MAP_UNPACK_WITH_CALL_BUILD_TUPLE_CALL_FUNCTION_EX():
validate_uncompyle("fn(a=0,**g)")
@pytest.mark.xfail()
def test_CALL_FUNCTION_EX():
validate_uncompyle("fn(*g,**j)")
@pytest.mark.xfail()
def test_BUILD_MAP_CALL_FUNCTION_EX():
validate_uncompyle("fn(*z,u=0)")
@pytest.mark.xfail()
def test_BUILD_TUPLE_CALL_FUNCTION_EX():
validate_uncompyle("fn(**a)")
@pytest.mark.xfail()
def test_BUILD_MAP_BUILD_TUPLE_BUILD_TUPLE_UNPACK_WITH_CALL_CALL_FUNCTION_EX():
validate_uncompyle("fn(b,b,b=0,*a)")
@pytest.mark.xfail()
def test_BUILD_TUPLE_BUILD_TUPLE_UNPACK_WITH_CALL_CALL_FUNCTION_EX():
validate_uncompyle("fn(*c,v)")
@pytest.mark.xfail()
def test_BUILD_CONST_KEY_MAP_CALL_FUNCTION_EX():
validate_uncompyle("fn(i=0,y=0,*p)")
@pytest.mark.skip(reason='skipping property based test until all individual tests are passing')
@given(function_calls())
def test_function_call(function_call):
validate_uncompyle(function_call)

View File

@@ -1,89 +1,111 @@
import re
from uncompyle6 import PYTHON_VERSION, PYTHON3, IS_PYPY # , PYTHON_VERSION
from uncompyle6 import PYTHON_VERSION, PYTHON3, IS_PYPY # , PYTHON_VERSION
from uncompyle6.parser import get_python_parser, python_parser
from uncompyle6.scanner import get_scanner
def test_grammar():
def test_grammar():
def check_tokens(tokens, opcode_set):
remain_tokens = set(tokens) - opcode_set
remain_tokens = set([re.sub(r'_\d+$','', t) for t in remain_tokens])
remain_tokens = set([re.sub('_CONT$','', t) for t in remain_tokens])
remain_tokens = set([re.sub('LOAD_CODE$','', t) for t in remain_tokens])
remain_tokens = set([re.sub(r"_\d+$", "", t) for t in remain_tokens])
remain_tokens = set([re.sub("_CONT$", "", t) for t in remain_tokens])
remain_tokens = set([re.sub("LOAD_CODE$", "", t) for t in remain_tokens])
remain_tokens = set(remain_tokens) - opcode_set
assert remain_tokens == set([]), \
"Remaining tokens %s\n====\n%s" % (remain_tokens, p.dump_grammar())
assert remain_tokens == set([]), "Remaining tokens %s\n====\n%s" % (
remain_tokens,
p.dump_grammar(),
)
p = get_python_parser(PYTHON_VERSION, is_pypy=IS_PYPY)
(lhs, rhs, tokens,
right_recursive, dup_rhs) = p.check_sets()
(lhs, rhs, tokens, right_recursive, dup_rhs) = p.check_sets()
# We have custom rules that create the below
expect_lhs = set(['pos_arg', 'attribute'])
expect_lhs = set(["pos_arg"])
if PYTHON_VERSION < 3.8:
expect_lhs.add('get_iter')
if PYTHON_VERSION < 3.7:
expect_lhs.add("attribute")
expect_lhs.add("get_iter")
unused_rhs = set(['list', 'mkfunc',
'mklambda',
'unpack',])
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")
expect_right_recursive = set([('designList',
('store', 'DUP_TOP', 'designList'))])
unused_rhs = set(["list", "mkfunc", "mklambda", "unpack"])
if PYTHON_VERSION < 3.7:
unused_rhs.add('call')
expect_right_recursive = set([("designList", ("store", "DUP_TOP", "designList"))])
if PYTHON_VERSION <= 3.6:
unused_rhs.add("call")
if PYTHON_VERSION > 2.6:
expect_lhs.add('kvlist')
expect_lhs.add('kv3')
unused_rhs.add('dict')
expect_lhs.add("kvlist")
expect_lhs.add("kv3")
unused_rhs.add("dict")
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')
expect_lhs.add("load_genexpr")
unused_rhs = unused_rhs.union(set("""
unused_rhs = unused_rhs.union(
set(
"""
except_pop_except generator_exp
""".split()))
""".split()
)
)
if PYTHON_VERSION >= 3.0:
expect_lhs.add("annotate_arg")
expect_lhs.add("annotate_tuple")
unused_rhs.add("mkfunc_annotate")
if PYTHON_VERSION < 3.7:
expect_lhs.add("annotate_arg")
expect_lhs.add("annotate_tuple")
unused_rhs.add("mkfunc_annotate")
unused_rhs.add("dict_comp")
unused_rhs.add("classdefdeco1")
unused_rhs.add("tryelsestmtl")
if PYTHON_VERSION >= 3.5:
expect_right_recursive.add((('l_stmts',
('lastl_stmt', 'come_froms', 'l_stmts'))))
pass
elif 3.0 < PYTHON_VERSION < 3.3:
expect_right_recursive.add((('l_stmts',
('lastl_stmt', 'COME_FROM', 'l_stmts'))))
expect_right_recursive.add(
(("l_stmts", ("lastl_stmt", "come_froms", "l_stmts")))
)
pass
pass
pass
else:
expect_lhs.add('kwarg')
assert expect_lhs == set(lhs)
expect_lhs.add("kwarg")
# FIXME
if PYTHON_VERSION != 3.8:
if PYTHON_VERSION < 3.8:
assert expect_lhs == set(lhs)
assert unused_rhs == set(rhs)
assert expect_right_recursive == right_recursive
expect_dup_rhs = frozenset([('COME_FROM',), ('CONTINUE',), ('JUMP_ABSOLUTE',),
('LOAD_CONST',),
('JUMP_BACK',), ('JUMP_FORWARD',)])
expect_dup_rhs = frozenset(
[
("COME_FROM",),
("CONTINUE",),
("JUMP_ABSOLUTE",),
("LOAD_CONST",),
("JUMP_BACK",),
("JUMP_FORWARD",),
]
)
reduced_dup_rhs = dict((k, dup_rhs[k]) for k in dup_rhs if k not in expect_dup_rhs)
for k in reduced_dup_rhs:
print(k, reduced_dup_rhs[k])
if reduced_dup_rhs:
print("\nPossible duplicate RHS that might be folded, into one of the LHS symbols")
for k in reduced_dup_rhs:
print(k, reduced_dup_rhs[k])
# assert not reduced_dup_rhs, reduced_dup_rhs
s = get_scanner(PYTHON_VERSION, IS_PYPY)
ignore_set = set(
"""
"""
JUMP_BACK CONTINUE
COME_FROM COME_FROM_EXCEPT
COME_FROM_EXCEPT_CLAUSE
@@ -92,22 +114,33 @@ def test_grammar():
LOAD_GENEXPR LOAD_ASSERT LOAD_SETCOMP LOAD_DICTCOMP LOAD_STR LOAD_CODE
LAMBDA_MARKER
RETURN_END_IF RETURN_END_IF_LAMBDA RETURN_VALUE_LAMBDA RETURN_LAST
""".split())
""".split()
)
if 2.6 <= PYTHON_VERSION <= 2.7:
opcode_set = set(s.opc.opname).union(ignore_set)
if PYTHON_VERSION == 2.6:
opcode_set.add("THEN")
check_tokens(tokens, opcode_set)
elif PYTHON_VERSION == 3.4:
ignore_set.add('LOAD_CLASSNAME')
ignore_set.add('STORE_LOCALS')
ignore_set.add("LOAD_CLASSNAME")
ignore_set.add("STORE_LOCALS")
opcode_set = set(s.opc.opname).union(ignore_set)
check_tokens(tokens, opcode_set)
def test_dup_rule():
import inspect
python_parser(PYTHON_VERSION, inspect.currentframe().f_code,
is_pypy=IS_PYPY,
parser_debug={
'dups': True, 'transition': False, 'reduce': False,
'rules': False, 'errorstack': None, 'context': True})
python_parser(
PYTHON_VERSION,
inspect.currentframe().f_code,
is_pypy=IS_PYPY,
parser_debug={
"dups": True,
"transition": False,
"reduce": False,
"rules": False,
"errorstack": None,
"context": True,
},
)

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'
L. 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
L. 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'
L. 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'
L. 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
L. 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

@@ -1,4 +1,3 @@
flake8
hypothesis<=3.0.0
six
pytest==3.2.5
pytest==3.2.5 # for 2.7 < PYTHON_VERSION <= 3.2 use pytest 2.9.2; for 3.1 2.10

View File

@@ -2,10 +2,10 @@
release = 1
packager = rocky <rb@dustyfeet.com>
doc_files = README
# CHANGES.txt
# USAGE.txt
# doc/
# examples/
[bdist_wheel]
# universal=1
[egg_info]
tag_build =
tag_date = 0

View File

@@ -4,8 +4,8 @@ import sys
"""Setup script for the 'uncompyle6' distribution."""
SYS_VERSION = sys.version_info[0:2]
if not ((2, 6) <= SYS_VERSION <= (3, 8)):
mess = "Python Release 2.6 .. 3.8 are supported in this code branch."
if not ((2, 6) <= SYS_VERSION <= (3, 9)):
mess = "Python Release 2.6 .. 3.9 are supported in this code branch."
if ((2, 4) <= SYS_VERSION <= (2, 7)):
mess += ("\nFor your Python, version %s, use the python-2.4 code/branch." %
sys.version[0:3])
@@ -32,6 +32,7 @@ setup(
install_requires = install_requires,
license = license,
long_description = long_description,
long_description_content_type = "text/x-rst",
name = modname,
packages = find_packages(),
py_modules = py_modules,

2
test/.gitignore vendored
View File

@@ -1 +1,3 @@
/.coverage
/.python-version
/nohup.out

View File

@@ -1,5 +1,6 @@
PHONY=check clean dist distclean test test-unit test-functional rmChangeLog clean_pyc nosetests \
check-bytecode-1 check-bytecode-1.3 check-bytecode-1.4 check-bytecode-1.5 \
check-bytecode-1.0 check-bytecode-1.1 check-bytecode-1.2 check-bytecode-1.3 \
check-bytecode-1 check-bytecode-1.4 check-bytecode-1.5 check-bytecode-1.6 \
check-bytecode-2 check-bytecode-3 check-bytecode-3-short \
check-bytecode-2.2 check-byteocde-2.3 check-bytecode-2.4 \
check-short check-2.6 check-2.7 check-3.0 check-3.1 check-3.2 check-3.3 \
@@ -22,7 +23,7 @@ COVER_DIR=../tmp/grammar-cover
# Run short tests
check-short:
@$(PYTHON) -V && PYTHON_VERSION=`$(PYTHON) -V 2>&1 | cut -d ' ' -f 2 | cut -d'.' -f1,2`; \
$(MAKE) check-bytecode-short
$(MAKE) check-bytecode-$${PYTHON_VERSION}
# Run all tests
check:
@@ -77,7 +78,7 @@ check-3.8: check-bytecode
$(PYTHON) test_pythonlib.py --bytecode-3.8 --syntax-verify $(COMPILE)
# FIXME
#: this is called when running under pypy3.5-5.8.0 or pypy2-5.6.0
#: this is called when running under pypy3.5-5.8.0, pypy2-5.6.0, or pypy3.6-7.3.0
5.8 5.6:
#: Check deparsing only, but from a different Python version
@@ -85,7 +86,7 @@ check-disasm:
$(PYTHON) dis-compare.py
#: Check deparsing bytecode 1.x only
check-bytecode-1: check-bytecode-1.4 check-bytecode-1.5
check-bytecode-1: check-bytecode-1.0 check-bytecode-1.1 check-bytecode-1.2 check-bytecode-1.3 check-bytecode-1.4 check-bytecode-1.5 check-bytecode-1.6
#: Check deparsing bytecode 2.x only
check-bytecode-2:
@@ -98,8 +99,8 @@ check-bytecode-3:
$(PYTHON) test_pythonlib.py --bytecode-3.0 \
--bytecode-3.1 --bytecode-3.2 --bytecode-3.3 \
--bytecode-3.4 --bytecode-3.5 --bytecode-3.6 \
--bytecode-3.7 --bytecode-3.8 \
--bytecode-pypy3.2
--bytecode-3.7 \
--bytecode-pypy3.2 --bytecode-pypy3.6 --bytecode-3.8
#: Check deparsing on selected bytecode 3.x
check-bytecode-3-short:
@@ -109,6 +110,7 @@ check-bytecode-3-short:
#: Check deparsing bytecode on all Python 2 and Python 3 versions
check-bytecode: check-bytecode-3
$(PYTHON) test_pythonlib.py \
--bytecode-1.0 --bytecode-1.1 --bytecode-1.2 \
--bytecode-1.3 --bytecode-1.4 --bytecode-1.5 \
--bytecode-2.2 --bytecode-2.3 --bytecode-2.4 \
--bytecode-2.1 --bytecode-2.2 --bytecode-2.3 --bytecode-2.4 \
@@ -122,6 +124,18 @@ check-bytecode-short: check-bytecode-3-short
--bytecode-2.6 --bytecode-2.7 --bytecode-pypy2.7
#: Check deparsing bytecode 1.0 only
check-bytecode-1.0:
$(PYTHON) test_pythonlib.py --bytecode-1.0
#: Check deparsing bytecode 1.1 only
check-bytecode-1.1:
$(PYTHON) test_pythonlib.py --bytecode-1.1
#: Check deparsing bytecode 1.2 only
check-bytecode-1.2:
$(PYTHON) test_pythonlib.py --bytecode-1.2
#: Check deparsing bytecode 1.3 only
check-bytecode-1.3:
$(PYTHON) test_pythonlib.py --bytecode-1.3
@@ -134,6 +148,10 @@ check-bytecode-1.4:
check-bytecode-1.5:
$(PYTHON) test_pythonlib.py --bytecode-1.5
#: Check deparsing bytecode 1.6 only
check-bytecode-1.6:
$(PYTHON) test_pythonlib.py --bytecode-1.6
#: Check deparsing Python 2.1
check-bytecode-2.1:
$(PYTHON) test_pythonlib.py --bytecode-2.1
@@ -314,8 +332,16 @@ pypy-2.7 5.0 5.3 6.0:
pypy-3.2 2.4:
$(PYTHON) test_pythonlib.py --bytecode-pypy3.2 --verify
#: PyPy 5.0.x with Python 3.6 ...
#: PyPy 5.0.x with Python 3.6.1 ...
check-bytecode-pypy3.6: 7.1
7.1:
$(PYTHON) test_pythonlib.py --bytecode-pypy3.6-run --verify-run
$(PYTHON) test_pythonlib.py --bytecode-pypy3.6 --verify
#: PyPy 5.0.x with Python 3.6.9
check-bytecode-pypy3.6: 7.2 7.3
7.3 7.2:
$(PYTHON) test_pythonlib.py --bytecode-pypy3.6-run --verify-run
$(PYTHON) test_pythonlib.py --bytecode-pypy3.6 --verify

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.

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.

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