ljd
ljd copied to clipboard
ASCII codec error
$ python3 main.py foo.luac
Traceback (most recent call last):
File "main.py", line 123, in <module>
retval = main()
File "main.py", line 77, in main
header, prototype = ljd.rawdump.parser.parse(file_in)
File "/Users/agladysh/projects/ljd/ljd/rawdump/parser.py", line 34, in parse
r = r and _read_prototypes(parser, parser.prototypes)
File "/Users/agladysh/projects/ljd/ljd/rawdump/parser.py", line 72, in _read_prototypes
if not ljd.rawdump.prototype.read(state, prototype):
File "/Users/agladysh/projects/ljd/ljd/rawdump/prototype.py", line 52, in read
r = r and _read_constants(parser, prototype)
File "/Users/agladysh/projects/ljd/ljd/rawdump/prototype.py", line 140, in _read_constants
return ljd.rawdump.constants.read(parser, prototype.constants)
File "/Users/agladysh/projects/ljd/ljd/rawdump/constants.py", line 31, in read
r = r and _read_complex_constants(parser, constants.complex_constants)
File "/Users/agladysh/projects/ljd/ljd/rawdump/constants.py", line 59, in _read_complex_constants
complex_constants.append(string.decode("ascii"))
UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 22: ordinal not in range(128)
Unfortunately I can not share foo.luac
, but it is a valid LuaJIT 2.0.2 bytecode. Is there another way I can help you to debug this issue?
(I suspect that the problem is the string constant that contains binary data. Maybe not though.)
I think I encountered a similar bug, can you try branch bugfix
on my fork?
@jjdredd With your fork I'm getting a different error:
$ python3 main.py foo.luac
Traceback (most recent call last):
File "main.py", line 123, in <module>
retval = main()
File "main.py", line 104, in main
ljd.ast.unwarper.unwarp(ast)
File "/Users/agladysh/projects/ljd/ljd/ast/unwarper.py", line 35, in unwarp
_run_step(_unwarp_expressions, node)
File "/Users/agladysh/projects/ljd/ljd/ast/unwarper.py", line 43, in _run_step
statements.contents = step(statements.contents, **kargs)
File "/Users/agladysh/projects/ljd/ljd/ast/unwarper.py", line 125, in _unwarp_expressions
return _unwarp_expressions_pack(blocks, pack)
File "/Users/agladysh/projects/ljd/ljd/ast/unwarper.py", line 202, in _unwarp_expressions_pack
_unwarp_logical_expression(start, end, body)
File "/Users/agladysh/projects/ljd/ljd/ast/unwarper.py", line 492, in _unwarp_logical_expression
expression = _compile_expression([start] + body, end, true, false)
File "/Users/agladysh/projects/ljd/ljd/ast/unwarper.py", line 504, in _compile_expression
parts = _unwarp_expression(body, end, true, false)
File "/Users/agladysh/projects/ljd/ljd/ast/unwarper.py", line 654, in _unwarp_expression
true, end)
File "/Users/agladysh/projects/ljd/ljd/ast/unwarper.py", line 781, in _compile_subexpression
return _unwarp_expression(subexpression, None, subtrue, subfalse)
File "/Users/agladysh/projects/ljd/ljd/ast/unwarper.py", line 650, in _unwarp_expression
operator = _get_operator(last_block, true, end)
File "/Users/agladysh/projects/ljd/ljd/ast/unwarper.py", line 711, in _get_operator
src = _get_last_assignment_source(block)
File "/Users/agladysh/projects/ljd/ljd/ast/unwarper.py", line 744, in _get_last_assignment_source
assert isinstance(assignment, nodes.Assignment)
AssertionError
yes, unwarper is broken, just like slotworks, the locals module needs work too, not much time currently to do this