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

Fix for fake filenames in verbose traceback #1716

Merged
merged 1 commit into from May 27, 2012

Conversation

takluyver
Copy link
Member

While testing PR #1715, I noticed that the verbose traceback mode wasn't displaying variables as it should. This was because the fake filenames we use like <ipython-input-8-90b61b657670> were being treated as real filenames. We relied on os.path.abspath throwing an OSError for them, which it no longer does.

This fix assumes that any filename enclosed by <> should be treated as not a real file. It may well be possible to create real files with such names, but it would be very bizarre, and you wouldn't be able to import them.

@takluyver
Copy link
Member Author

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

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

Not available for testing: python2.6

@takluyver
Copy link
Member Author

@fperez @ellisonbg @minrk: I'll merge this one this evening or tomorrow unless anyone objects. It's a fairly simple fix.

fperez added a commit that referenced this pull request May 27, 2012
Fix for fake filenames in verbose traceback.

We use in our frames fake filenames of the type `<ipython....>`, and we relied on `abspath` throwing an `OSError` exception with them.  That is no longer the case, and it leads to verbose tracebacks not inspecting IPython frames correctly.

This fixes the issue by simply assuming that any file that starts/ends with `</>` can't be a normal python file, which is a sensible policy (for one thing, such names can't be imported).
@fperez fperez merged commit 5e31374 into ipython:master May 27, 2012
@fperez
Copy link
Member

fperez commented May 27, 2012

Reviewed, merged. Good job, thanks!

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Fix for fake filenames in verbose traceback.

We use in our frames fake filenames of the type `<ipython....>`, and we relied on `abspath` throwing an `OSError` exception with them.  That is no longer the case, and it leads to verbose tracebacks not inspecting IPython frames correctly.

This fixes the issue by simply assuming that any file that starts/ends with `</>` can't be a normal python file, which is a sensible policy (for one thing, such names can't be imported).
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