Fix issue 447 - inspecting old-style classes. #449

merged 2 commits into from May 17, 2011


None yet

3 participants


Tweak so it doesn't fail on old style classes. Added test.

Closes gh-447


You can just do callable_obj = getattr(obj, '__init__', obj). A class object itself is callable.


It is, but getargspec won't handle a class.

Interesting, because I made exactly this change and it works just fine.

class A:

correctly shows 'doc' in the tooltip.


The bit that gets the docstring is working already, this is just an incidental error in with old-style classes. I've just checked, and we catch the error from getargspec, so the result will be the same. I went for catching AttributeError because it's a pattern that's used several times already in the info method.

Fair enough. I still like getattr(obj, '__init__', None) better than 4 lines, but that's not important. I say merge.


Actually, yes. While we're here, let's make it tidy...


I wish to preemptively apologize for this and future things I will break in iPython. By mid-July, I expect I will know the code base well enough to start pitching in.

Thanks guys :)


@meawoppl: Don't worry - you didn't break it, you just found that it was already broken. We like people to find bugs before release. Especially when they're easily fixed, like this one.

Waiting an hour or so for any objections, then we'll merge, since it's a small fix.

@takluyver takluyver merged commit 12af0e2 into ipython:master May 17, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment