-
Notifications
You must be signed in to change notification settings - Fork 3
fix interpreter source traceback #602
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
Changes from 4 commits
24761a7
39123e3
5aaeabd
a52bf66
15626ea
b11d3fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -264,7 +264,12 @@ def new_frame( | |
| self.state.push_frame(frame) | ||
| try: | ||
| yield frame | ||
| finally: | ||
| except BaseException: | ||
| # NOTE: Don't pop frames on exception so that eval_context | ||
| # can capture the full frame chain for the stack trace. | ||
| # The state is re-initialized on the next eval_context call. | ||
| raise | ||
| else: | ||
| self.state.pop_frame() | ||
|
Comment on lines
+268
to
273
|
||
|
|
||
| def frame_eval( | ||
|
|
||
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.
new_framenow catchesBaseExceptionand deliberately leaves frames on the interpreter state. This meansKeyboardInterrupt/SystemExitwill also leave the interpreter stack dirty, and it also doesn't line up witheval_context, which only annotatesExceptioninstances withKIRIN_INTERP_STATE. Consider catchingExceptionhere (or alternatively updatingeval_contextto handleBaseExceptionand resettingself.stateafter attaching it to the raised exception) so non-error control-flow exceptions don't leak frames.