Skip to content
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

%debug magic doesn't capture the locals #13959

Closed
impact27 opened this issue Mar 4, 2023 · 0 comments · Fixed by #13960
Closed

%debug magic doesn't capture the locals #13959

impact27 opened this issue Mar 4, 2023 · 0 comments · Fixed by #13960

Comments

@impact27
Copy link
Contributor

impact27 commented Mar 4, 2023

To reproduce:
1 - create a file test.ipy:

def fun():
    res = 1
    %debug print(res)
fun()

2 - run with ipython test.ipy
3 - After pressing continue on the pdb promt, I get:
NameError: name 'res' is not defined

This is in contrast with the following code, which works:

def fun():
    res = 1
    %timeit print(res)
fun()

The difference seems to be that the timeit magic is decorated with @needs_local_scope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant