Skip to content

wildfire breaks uncompyle2 #12

Description

@0vercl0k

Hi Mysterie,

Recently I have been playing on with Python bytecodes to do weird stuff for fun, and I just saw the python-compiled file I am generating seem to break uncompyle2.
Here is an example:

overclok@spartacus:/tmp$ git clone https://github.com/Mysterie/uncompyle2.git
Cloning into uncompyle2...
[...]
overclok@spartacus:/tmp$ wget "https://github.com/0vercl0k/stuffz/raw/master/Python's%20internals/wildfired_samples/very_understandable_function.Py273.pyc"
[...]
overclok@spartacus:/tmp$ python2.7 uncompyle2/uncompyle2.py very_understandable_function.Py273.pyc
#2013.05.02 17:59:54 UTC

# Can't uncompyle very_understandable_function.Py273.pyc
Traceback (most recent call last):
  File "/tmp/uncompyle2/uncompyle2/__init__.py", line 209, in main
    uncompyle_file(infile, outstream, showasm, showast)
  File "/tmp/uncompyle2/uncompyle2/__init__.py", line 146, in uncompyle_file
    uncompyle(version, co, outstream, showasm, showast)
  File "/tmp/uncompyle2/uncompyle2/__init__.py", line 131, in uncompyle
    walk.gen_source(ast, customize)
  File "/tmp/uncompyle2/uncompyle2/walker.py", line 1407, in gen_source
    self.print_(self.traverse(ast, isLambda=isLambda))
  File "/tmp/uncompyle2/uncompyle2/walker.py", line 493, in traverse
    self.preorder(node)
  File "/tmp/uncompyle2/uncompyle2/spark.py", line 694, in preorder
    self.preorder(kid)
  File "/tmp/uncompyle2/uncompyle2/spark.py", line 694, in preorder
    self.preorder(kid)
  File "/tmp/uncompyle2/uncompyle2/spark.py", line 694, in preorder
    self.preorder(kid)
  File "/tmp/uncompyle2/uncompyle2/spark.py", line 689, in preorder
    self.default(node)
  File "/tmp/uncompyle2/uncompyle2/walker.py", line 1181, in default
    self.engine(table[key], node)
  File "/tmp/uncompyle2/uncompyle2/walker.py", line 1131, in engine
    self.preorder(node[entry[arg]])
  File "/tmp/uncompyle2/uncompyle2/spark.py", line 687, in preorder
    func(node)
  File "/tmp/uncompyle2/uncompyle2/walker.py", line 879, in n_mkfunc
    self.make_function(node, isLambda=0)
  File "/tmp/uncompyle2/uncompyle2/walker.py", line 1282, in make_function
    code = Code(code, self.scanner, self.currentclass)
  File "/tmp/uncompyle2/uncompyle2/scanner.py", line 60, in __init__
    self._tokens, self._customize = scanner.disassemble(co, classname)
  File "/tmp/uncompyle2/uncompyle2/scanner27.py", line 81, in disassemble
    if names[self.get_argument(i+3)] == 'AssertionError':
IndexError: tuple index out of range
# decompiled 0 files: 0 okay, 1 failed, 0 verify failed
#2013.05.02 17:59:54 UTC

By the way, same problem with the Python 2.6.6 equivalent file available here: https://github.com/0vercl0k/stuffz/raw/master/Python's%20internals/wildfired_samples/very_understandable_function.Py266.pyc
Also, if you want to see how those files are generated, see wildfire.py: https://github.com/0vercl0k/stuffz/blob/master/Python's%20internals/wildfire.py

Feel free to email me if you don't manage to reproduce the Python traceback!

Cheers,
0vercl0k

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions