-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RPYTHON: embed rpython code line as a comment in the generated C #4837
base: main
Are you sure you want to change the base?
Conversation
code = self.pycode | ||
linenum = self.last_offset | ||
src = self.graph.source.split('\n')[linenum] | ||
text = '%s:%d : %s' % (code.co_name, linenum, src) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part fails. self.pycode is the compiled bytecode, and the last_offset
relates to a bytecode offset, not a code linenum. Do we have any information about the line number in the source code anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, you can call offset2lineno(code, self.last_offset)
to get the line number. the function is in rpython.tool.error
.
except Exception as e: | ||
print(e) | ||
import pdb;pdb.set_trace() | ||
raise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this when the comment creation works
except Exception as e: | |
print(e) | |
import pdb;pdb.set_trace() | |
raise |
cool! pitfalls that I can think off:
you should probably add some unit tests to:
|
This started as a patch to #1220. I am trying to update it.