CrashHandler doesn't inspect modules properly #19

Closed
ipython opened this Issue May 10, 2010 · 3 comments

Comments

Projects
None yet
3 participants
@ghost
Collaborator

ghost commented May 10, 2010

Original Launchpad bug 515652: https://bugs.launchpad.net/ipython/+bug/515652
Reported by: ellisonbg (Brian Granger).

If I make Magic an object and look at the crash reporter I see things like:

   global The = undefined
   global Component = <class 'IPython.core.component.Component'>
   global subclass = undefined
   global that = undefined
   instance = undefined
   global will = undefined
   global   = undefined
   global to = undefined
   global be. = undefined

The variables here are not in Python code but are words from a
docstring in that module.
Any idea on what is going on here?

Is it by any chance being loaded at runtime and the file may have
changed since you started ipython? The python inspection libraries
have caching bugs, I try in several places to flush those caches to
avoid this problem, but I may not be doing it right everywhere.

This is old, old, horrible code I hacked very early on in ipython's
life on top of something I hadn't written and that was pretty bad to
begin with. It's in serious need of a test suite so it can be
refactored...

At least as a pointer, the machinery responsible is around here:

http://bazaar.launchpad.net/%7Efdo.perez/ipython/trunk-dev/annotate/head%3A/IPython/core/ultratb.py#L788

So what's happening is that the list of 'unique names' being generated
is for some reason being computed from the wrong line of code, so text
from a docstring is read instead of text from the proper line of
source that originated the exception.

Sorry not to be more helpful, this is something that needs a solid
chunk of deep work at some point, not something we can clear quickly
(the refactoring I mean, this little bug might be fixable with a
one-line change somewhere).

@ghost ghost assigned fperez Apr 10, 2011

@minrk

This comment has been minimized.

Show comment Hide comment
@minrk

minrk Jun 27, 2011

Member

Do we have any tests for this, to see if it's still a problem?

Member

minrk commented Jun 27, 2011

Do we have any tests for this, to see if it's still a problem?

@fperez

This comment has been minimized.

Show comment Hide comment
@fperez

fperez Nov 30, 2011

Member

I think it's still a problem, b/c I've seen cases where I try to get exceptions with %xmode verbose (which is what the crash handler uses) and I don't get all the variables correctly reported. But that stuff is not worth fighting until we write at least some tests for the exception handler, which has zilch in the way of tests...

Member

fperez commented Nov 30, 2011

I think it's still a problem, b/c I've seen cases where I try to get exceptions with %xmode verbose (which is what the crash handler uses) and I don't get all the variables correctly reported. But that stuff is not worth fighting until we write at least some tests for the exception handler, which has zilch in the way of tests...

fperez referenced this issue in minrk/ipython Jul 1, 2013

Merge pull request #19 from minrk/html
Add further HTML export
@fperez

This comment has been minimized.

Show comment Hide comment
@fperez

fperez Feb 1, 2014

Member

I've played a bit with this and can't reproduce. Since the report has no test case we can use, I'm going to close this one. We now have much more reasonable testing machinery, so if we catch it again we can reopen with a proper test case.

Member

fperez commented Feb 1, 2014

I've played a bit with this and can't reproduce. Since the report has no test case we can use, I'm going to close this one. We now have much more reasonable testing machinery, so if we catch it again we can reopen with a proper test case.

@fperez fperez closed this Feb 1, 2014

jdfreder added a commit that referenced this issue Mar 7, 2014

Merge pull request #19 from ellisonbg/nbc-style
Lots of CSS tweaks to get nbconvert output looking right.

takluyver referenced this issue in takluyver/ipython Sep 9, 2014

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014

Merge pull request #19 from ellisonbg/nbc-style
Lots of CSS tweaks to get nbconvert output looking right.

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment