-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
Hi,
I tried the following snippet:
>>> import meta.decompiler
>>> f = lambda: (lambda: 4).__call__()
>>> f
<function <lambda> at 0x7fafb00e11e0>
>>> meta.decompiler.decompile_func(f)Unfortunately, this raises an exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/marko/workspace/pqryopen/icontract/venv3/lib/python3.5/site-packages/meta/decompiler/__init__.py", line 37, in decompile_func
ast_node = make_function(code, defaults=[], lineno=code.co_firstlineno)
File "/home/marko/workspace/pqryopen/icontract/venv3/lib/python3.5/site-packages/meta/decompiler/instructions.py", line 137, in make_function
stmnts = instructions.stmnt()
File "/home/marko/workspace/pqryopen/icontract/venv3/lib/python3.5/site-packages/meta/decompiler/instructions.py", line 310, in stmnt
self.visit(instr)
File "/home/marko/workspace/pqryopen/icontract/venv3/lib/python3.5/site-packages/meta/decompiler/instructions.py", line 324, in visit
method(instr)
File "/home/marko/workspace/pqryopen/icontract/venv3/lib/python3.5/site-packages/meta/decompiler/instructions.py", line 372, in MAKE_FUNCTION
function = make_function(code, defaults, lineno=instr.lineno, annotations=annotations, kw_defaults=kw_defaults)
File "/home/marko/workspace/pqryopen/icontract/venv3/lib/python3.5/site-packages/meta/decompiler/instructions.py", line 135, in make_function
instructions = Instructions(disassemble(code))
File "/home/marko/workspace/pqryopen/icontract/venv3/lib/python3.5/site-packages/meta/decompiler/disassemble.py", line 20, in disassemble
return list(disassembler(co))
File "/home/marko/workspace/pqryopen/icontract/venv3/lib/python3.5/site-packages/meta/bytecodetools/disassembler_.py", line 26, in disassembler
code = co.co_code
AttributeError: 'Str' object has no attribute 'co_code'
I looked into the value of co in this particular trace:
co is: <_ast.Str object at 0x7f19130360b8>
co.s is: '<lambda>.<locals>.<lambda>'
Any chance you could have a look and guide me a bit? I'm pretty much lost at how to fix this bug.
Metadata
Metadata
Assignees
Labels
No labels