Permalink
Browse files

Better check for missing source in Inspector.info()

  • Loading branch information...
1 parent 7ee70a7 commit ec4f4ff6ae53180eaf30877801e313b2053425dd @takluyver committed May 16, 2011
Showing with 5 additions and 4 deletions.
  1. +5 −4 IPython/core/oinspect.py
View
@@ -571,7 +571,7 @@ def info(self, obj, oname='', formatter=None, info=None, detail_level=0):
# Flush the source cache because inspect can return out-of-date
# source
linecache.checkcache()
- source_success = False
+ source = None
try:
try:
src = getsource(obj,binary_file)
@@ -581,10 +581,11 @@ def info(self, obj, oname='', formatter=None, info=None, detail_level=0):
if src is not None:
source = self.format(src)
out['source'] = source.rstrip()
- source_success = True
except Exception:
- if ds:
- out['docstring'] = ds
+ pass
+
+ if ds and source is None:
+ out['docstring'] = ds
# Constructor docstring for classes

0 comments on commit ec4f4ff

Please sign in to comment.