-
Notifications
You must be signed in to change notification settings - Fork 143
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
ipython support: consider that ipython will create multiple frames (one for each line) for what should be logically a single frame #869
Comments
Is there any following up for this? I think this feature is highly expected in vscode, microsoft/vscode-jupyter#8146. |
I've started to take a look at this. |
Some mental notes on the actual problem / approach I decided to take: Problem:
Given those constraints, I'm thinking about the following approach:
Note: we don't really need to check for frame locals, which is much more expensive performance-wise (so, I'm thinking about something as:
In practice, for IPython this'd be something as:
|
@fabioz Thanks for outlining the plan. It mostly seems good to me. Tagging @Carreau for any input he might have on this solution, as he was the one that added
|
Yeah, it's a bit tricky, but I think a general "user"-definable set of predicate that basically respond to the question "should I really stop here" seem useful in general. |
They're actually separate (the filtering logic can probably use the same info though... anyways, this is a 2nd step and much easier to do than controlling the stepping).
Agreed ;) |
Just to note, I'm currently still working on this. The basic idea is implemented locally, but I'm dealing with some corner cases dealing with coroutines (so, this will take a bit longer than I anticipated). |
As a note, the issue isn't just with coroutines, the issue is how IPython itself does the execution of the function (I got a bit sidetracked because I went first to tackle the coroutines case and became confused when each new line was showing a different frame under the debugger). Let me exemplify. Given some code as:
IPython will actually make 2 calls to
and a Later on the execution of I'll have to thinker a bit more about the best approach here (this task already took me much more time than I anticipated, so, I'll probably have to reorganize my priorities to check if I can keep on it). As a note, the original request (to debug only code called from some frame) may not really be needed to implement this feature (the actual request is debugging with IPython without the |
I'm going back to tackle this issue. I'm still investigating which approach to take, so, I think it may take a while until I can find a good solution. |
@vidartf I've just provided a pull request which should fix it the issue (I still haven't tested properly with async code in IPython, so, it may still need work, but it should work for non-async code). If you'd like, you can test it by getting the code in the PR: #998 (see comments in the PR for how to enable it). |
In this case the request would be hiding/ignoring anything that's not called inside some function (namely
async def run_code(self, code_obj, result=None, *, async_=False):
: https://github.com/ipython/ipython/blob/de8729a984272b023768a8b85295ae06146da71d/IPython/core/interactiveshell.py#L3325).We could rely on the
__tracebackhide__ == "__ipython_bottom__"
local variable in that function.See: ipython/ipykernel#878 for details.
The text was updated successfully, but these errors were encountered: