python-uncompyle6
python-uncompyle6 copied to clipboard
Handling pathological Python programs with thousands statements in a block - RuntimeError: maximum recursion depth exceeded in cmp
.pyc script doesn't have any opcodes for compare. source code like: TEXT_ACCOUNT_545 = ' ' TEXT_ACCOUNT_550 = ' \n %s%s\n %s%s' TEXT_ACCOUNT_560 = ' ' TEXT_ACCOUNT_564 = '\xd0\x9e\xd0\x9a ' TEXT_APPSETTING_503 = ' ' TEXT_APPSETTING_506 = ' ' etc. .pyc for debug this bug is: http://rgho.st/6KbCGMX7D (new link)
While this is a bug, it is a very pathological case. A file with something like 10K lines of assignment statements.
Something along the lines of this patch unc-bug.txt
will remove the recursion problem, but the run time is pretty slow.
I don't have the time to work on this in the near future. However, since this seems to be about decoding some sort of game file, maybe you have time to start with the patch and revise as necessary.
I now understand how to address this in using the ambiguous grammar Earley parser.
https://github.com/rocky/python-decompile3/tree/stmt-block has experimental code. However this will probably only really be addressed when better basic-block handling is incorporated since the key inside revolves around basic-block detection.
As Chet Ramey quotes:
`The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates