{"action":"closed","issue":{"url":"https://api.github.com/repos/dropbox/pyston/issues/1279","repository_url":"https://api.github.com/repos/dropbox/pyston","labels_url":"https://api.github.com/repos/dropbox/pyston/issues/1279/labels{/name}","comments_url":"https://api.github.com/repos/dropbox/pyston/issues/1279/comments","events_url":"https://api.github.com/repos/dropbox/pyston/issues/1279/events","html_url":"https://github.com/dropbox/pyston/issues/1279","id":163564554,"number":1279,"title":"Wrong line number in AST_stmt?","user":{"login":"Daetalus","id":3905926,"avatar_url":"https://avatars.githubusercontent.com/u/3905926?v=3","gravatar_id":"","url":"https://api.github.com/users/Daetalus","html_url":"https://github.com/Daetalus","followers_url":"https://api.github.com/users/Daetalus/followers","following_url":"https://api.github.com/users/Daetalus/following{/other_user}","gists_url":"https://api.github.com/users/Daetalus/gists{/gist_id}","starred_url":"https://api.github.com/users/Daetalus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Daetalus/subscriptions","organizations_url":"https://api.github.com/users/Daetalus/orgs","repos_url":"https://api.github.com/users/Daetalus/repos","events_url":"https://api.github.com/users/Daetalus/events{/privacy}","received_events_url":"https://api.github.com/users/Daetalus/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-03T14:29:36Z","updated_at":"2016-07-12T04:22:29Z","closed_at":"2016-07-12T04:22:29Z","body":"Hi @kmod \r\nIn https://github.com/dropbox/pyston/pull/1253/commits/8bc8f8798fe80590898eb1bcf5c1ade9ac8ce0f9, you add line number to some ast node, and also add some line number assert in frame.cpp: https://github.com/dropbox/pyston/pull/1253/commits/8bc8f8798fe80590898eb1bcf5c1ade9ac8ce0f9#diff-bf4d352a2dac74a874df06a7d725bb39R145\r\n\r\nIn scipy, there has a module named `scipy.weave.accelerate_tools`. Which rely on CPython bytecode, due to we didn't support bytecode compiling. So import it will raise an exception: `ImportError: cannot import name accelerate_tools`.\r\n\r\nSciPy will try to execute the following statements insides the `weave` modules's init file(https://github.com/scipy/scipy/blob/master/scipy/weave/__init__.py#L55) :\r\n```\r\ntry:\r\n    import scipy.weave.accelerate_tools\r\nexcept:\r\n    pass\r\n```\r\n\r\nIt will cause Pyston report can't get correct line number:\r\n```\r\n../../src/runtime/frame.cpp:145: static pyston::Box *pyston::BoxedFrame::lineno(pyston::Box *, void *): Assertion `stmt->lineno > 0 && stmt->lineno < 1000000' failed: 0\r\n```\r\n\r\nIf try to execute these statements in REPL or other files except that `__init__` file. Everything goes fine. \r\n\r\nHere is the backtrace, hope it could helps.\r\n```\r\n(gdb) bt\r\n#0  0x00007ffff5188cc9 in raise () from /lib/x86_64-linux-gnu/libc.so.6\r\n#1  0x00007ffff518c0d8 in abort () from /lib/x86_64-linux-gnu/libc.so.6\r\n#2  0x00000000008177e1 in abort () at ../../src/codegen/unwinding.cpp:1136\r\n#3  0x00000000008b1358 in pyston::BoxedFrame::lineno (obj=0x7fffe012a960) at ../../src/runtime/frame.cpp:145\r\n#4  0x000000000166d6a5 in PyFrame_GetLineNumber (_f=0x7fffe012a960) at ../../src/runtime/frame.cpp:330\r\n#5  0x0000000000a8b2ef in newtracebackobject (next=0x0, frame=0x7fffe012a960) at ../../from_cpython/Python/traceback.c:104\r\n#6  0x0000000000a8b348 in PyTraceBack_Here_Tb (frame=0x7fffe012a960, tb=0x7fffffff8640) at ../../from_cpython/Python/traceback.c:128\r\n#7  0x0000000000819640 in pyston::_printStacktrace () at ../../src/codegen/unwinding.cpp:1083\r\n#8  0x0000000000817645 in abort () at ../../src/codegen/unwinding.cpp:1109\r\n#9  0x00000000008b1358 in pyston::BoxedFrame::lineno (obj=0x7fffe012a960) at ../../src/runtime/frame.cpp:145\r\n#10 0x000000000166d6a5 in PyFrame_GetLineNumber (_f=0x7fffe012a960) at ../../src/runtime/frame.cpp:330\r\n#11 0x0000000000a8b2ef in newtracebackobject (next=0x0, frame=0x7fffe012a960) at ../../from_cpython/Python/traceback.c:104\r\n#12 0x0000000000a8b348 in PyTraceBack_Here_Tb (frame=0x7fffe012a960, tb=0x7ffff4ba0aa0) at ../../from_cpython/Python/traceback.c:128\r\n#13 0x00000000008a9462 in pyston::exceptionAtLine (traceback=0x7ffff4ba0aa0) at ../../src/runtime/exceptions.cpp:313\r\n#14 0x000000000165f76c in pyston::PythonUnwindSession::handleCFrame (this=0x7ffff4ba0a90, cursor=0x7fffffff8f40) at ../../src/codegen/unwinding.cpp:625\r\n#15 0x0000000000817edd in pyston::unwindingThroughFrame (unwind_session=0x7ffff4ba0a90, cursor=0x7fffffff8f40) at ../../src/codegen/unwinding.cpp:663\r\n#16 0x0000000000898c9f in pyston::unwind_loop (exc_data=0x7ffff4ba0a90) at ../../src/runtime/cxx_unwind.cpp:517\r\n#17 0x0000000000897d2e in pyston::unwind (exc=0x7ffff4ba0a90) at ../../src/runtime/cxx_unwind.cpp:598\r\n#18 0x0000000000897cdb in _Unwind_Resume (_exc=0x7ffff4ba0a90) at ../../src/runtime/cxx_unwind.cpp:632\r\n#19 0x00000000006d300c in pyston::(anonymous namespace)::ASTInterpreter::visit_attribute (this=0x7fffffff9e48, node=0x7fffd9a71680) at ../../src/codegen/ast_interpreter.cpp:1778\r\n#20 0x000000000163b59c in pyston::(anonymous namespace)::ASTInterpreter::visit_expr (this=0x7fffffff9e48, node=0x7fffd9a71680) at ../../src/codegen/ast_interpreter.cpp:1431\r\n#21 0x00000000006d12c2 in pyston::(anonymous namespace)::ASTInterpreter::visit_assign (this=0x7fffffff9e48, node=0x7fffd9a71740) at ../../src/codegen/ast_interpreter.cpp:1382\r\n#22 0x000000000163c745 in pyston::(anonymous namespace)::ASTInterpreter::visit_stmt (this=0x7fffffff9e48, node=0x7fffd9a71740) at ../../src/codegen/ast_interpreter.cpp:999\r\n#23 0x00000000006c3ccc in pyston::(anonymous namespace)::ASTInterpreter::executeInner (interpreter=..., start_block=0x7fffd9a6e680, start_at=0x7fffdaff11a0) at ../../src/codegen/ast_interpreter.cpp:427\r\n#24 0x000000000163cc66 in executeInnerFromASM (interpreter=..., start_block=0x0, start_at=0x0) at ../../src/codegen/ast_interpreter.cpp:1911\r\n#25 0x00000000006dce31 in executeInnerAndSetupFrame () at ../../src/codegen/ast_interpreter_exec.S:34\r\n#26 0x00000000006c4655 in pyston::(anonymous namespace)::ASTInterpreter::execute (interpreter=..., start_block=0x0, start_at=0x0) at ../../src/codegen/ast_interpreter.cpp:435\r\n#27 0x000000000163b414 in pyston::astInterpretFunction (md=0x7fffd99e1300, closure=0x0, generator=0x0, globals=0x0, arg1=0x0, arg2=0x0, arg3=0x0, args=0x0) at ../../src/codegen/ast_interpreter.cpp:2015\r\n#28 0x000000000164b204 in pyston::compileAndRunModule (m=0x7fffd9abbd40, bm=0x7fffdb767f30) at ../../src/codegen/irgen/hooks.cpp:346\r\n#29 0x00000000008bb4d3 in load_source_module (name=0x7fffdaa0a010 \"scipy.weave.accelerate_tools\", pathname=0x7fffd9e99010 \"/home/sun/workspace/pyston/NumPy/site-packages/scipy/weave/accelerate_tools.py\", \r\n    fp=0x7fffdb487380) at ../../src/runtime/import.cpp:93\r\n#30 0x0000000000a75b8a in load_module (name=0x7fffdaa0a010 \"scipy.weave.accelerate_tools\", fp=0x7fffdb487380, \r\n    pathname=0x7fffd9e99010 \"/home/sun/workspace/pyston/NumPy/site-packages/scipy/weave/accelerate_tools.py\", type=1, loader=0x0) at ../../from_cpython/Python/import.c:1946\r\n#31 0x0000000000a79187 in import_submodule (mod=0x7fffdb767c30, subname=0x7fffdaa0a01c \"accelerate_tools\", fullname=0x7fffdaa0a010 \"scipy.weave.accelerate_tools\") at ../../from_cpython/Python/import.c:2742\r\n#32 0x0000000000a78687 in load_next (mod=0x7fffdb767c30, altmod=0x7fffdb767c30, p_name=0x7fffffffa4f0, buf=0x7fffdaa0a010 \"scipy.weave.accelerate_tools\", p_buflen=0x7fffffffa4c0)\r\n    at ../../from_cpython/Python/import.c:2557\r\n#33 0x0000000000a74db7 in import_module_level (name=0x0, globals=0x7fffe0129760, locals=0x0, fromlist=0x7ffff7f88040, level=0) at ../../from_cpython/Python/import.c:2272\r\n#34 0x0000000000a74b5a in PyImport_ImportModuleLevel (name=0x7fffd9abbd18 \"scipy.weave.accelerate_tools\", globals=0x7fffe0129760, locals=0x0, fromlist=0x7ffff7f88040, level=0)\r\n    at ../../from_cpython/Python/import.c:2328\r\n#35 0x00000000008bba4f in import (level=0, from_imports=0x7ffff7f88040, module_name=...) at ../../src/runtime/import.cpp:133\r\n#36 0x00000000006d6d17 in pyston::(anonymous namespace)::ASTInterpreter::visit_langPrimitive (this=0x7fffffffb198, node=0x7fffd9a862e0) at ../../src/codegen/ast_interpreter.cpp:909\r\n#37 0x000000000163b7a6 in pyston::(anonymous namespace)::ASTInterpreter::visit_expr (this=0x7fffffffb198, node=0x7fffd9a862e0) at ../../src/codegen/ast_interpreter.cpp:1469\r\n#38 0x00000000006d12c2 in pyston::(anonymous namespace)::ASTInterpreter::visit_assign (this=0x7fffffffb198, node=0x7fffd9a89d00) at ../../src/codegen/ast_interpreter.cpp:1382\r\n#39 0x000000000163c745 in pyston::(anonymous namespace)::ASTInterpreter::visit_stmt (this=0x7fffffffb198, node=0x7fffd9a89d00) at ../../src/codegen/ast_interpreter.cpp:999\r\n#40 0x00000000006d2bc5 in pyston::(anonymous namespace)::ASTInterpreter::visit_invoke (this=0x7fffffffb198, node=0x7fffd9a86370) at ../../src/codegen/ast_interpreter.cpp:831\r\n#41 0x000000000163cb59 in pyston::(anonymous namespace)::ASTInterpreter::visit_stmt (this=0x7fffffffb198, node=0x7fffd9a86370) at ../../src/codegen/ast_interpreter.cpp:1053\r\n#42 0x00000000006c3ccc in pyston::(anonymous namespace)::ASTInterpreter::executeInner (interpreter=..., start_block=0x7fffd9a6d240, start_at=0x7fffdaf71420) at ../../src/codegen/ast_interpreter.cpp:427\r\n#43 0x000000000163cc66 in executeInnerFromASM (interpreter=..., start_block=0x0, start_at=0x0) at ../../src/codegen/ast_interpreter.cpp:1911\r\n#44 0x00000000006dce31 in executeInnerAndSetupFrame () at ../../src/codegen/ast_interpreter_exec.S:34\r\n#45 0x00000000006c4655 in pyston::(anonymous namespace)::ASTInterpreter::execute (interpreter=..., start_block=0x0, start_at=0x0) at ../../src/codegen/ast_interpreter.cpp:435\r\n#46 0x000000000163b414 in pyston::astInterpretFunction (md=0x7fffd99e11c0, closure=0x0, generator=0x0, globals=0x0, arg1=0x0, arg2=0x0, arg3=0x0, args=0x0) at ../../src/codegen/ast_interpreter.cpp:2015\r\n```"}}
{"actor":{"display_login":"kmod"}}