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

Correct stack depth for variable expansion in !system commands #1879

Merged
merged 3 commits into from Jun 8, 2012

Conversation

takluyver
Copy link
Member

Closes issue #1878.

@takluyver
Copy link
Member Author

%magic commands already get the right stack depth, it was only a problem for !system commands. I've added tests for both.

@takluyver
Copy link
Member Author

Test results for commit 9e68e27 merged into master
Platform: linux2

  • python2.7: OK
  • python3.1: OK (libraries not available: cython matplotlib numpy pymongo qt rpy2 wx wx.aui zmq)
  • python3.2: OK (libraries not available: cython pymongo wx wx.aui)

Not available for testing: python2.6

@fperez
Copy link
Member

fperez commented Jun 8, 2012

Nice, thanks for doing this! BTW, I think we have similar problems with %run, in case you're in the stack-depth mindset ;)

Merging this one now, good work.

fperez added a commit that referenced this pull request Jun 8, 2012
Correct stack depth for variable expansion in !system commands

Closes #1878.
@fperez fperez merged commit 93e6672 into ipython:master Jun 8, 2012
@takluyver
Copy link
Member Author

You're welcome. What's the problem with %run? I'm not sure I've come across that.

@fperez
Copy link
Member

fperez commented Jun 9, 2012

In master:

In [3]: run ~/scratch/err
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
/home/fperez/ipython/ipython/IPython/utils/py3compat.pyc in execfile(fname, *where)
    176             else:
    177                 filename = fname
--> 178             __builtin__.execfile(filename, *where)

/home/fperez/scratch/err.py in <module>()
      7 f"""
      8 
----> 9 foo33

NameError: name 'foo33' is not defined

In 0.10.2:

In [1]: run /home/fperez/scratch/err
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

/home/fperez/scratch/err.py in <module>()
      7 f"""
      8 
----> 9 foo33
     10 
     11 

NameError: name 'foo33' is not defined
WARNING: Failure executing file: </home/fperez/scratch/err.py>

In master, we're showing an extra frame from our own code we shouldn't. I just haven't looked at the stack handling code, I'm sure the fix is just a similar frame offseta adjustment b/c we added the extra py3compat layer.

@takluyver
Copy link
Member Author

Ah, tracebacks. I'll see what I can find.

@fperez
Copy link
Member

fperez commented Jun 9, 2012

Awesome, thanks!

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Correct stack depth for variable expansion in !system commands

Closes ipython#1878.
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 this pull request may close these issues.

None yet

2 participants