##// END OF EJS Templates
Better check for missing source in Inspector.info()
Thomas Kluyver -
Show More
@@ -571,7 +571,7 b' class Inspector:'
571 # Flush the source cache because inspect can return out-of-date
571 # Flush the source cache because inspect can return out-of-date
572 # source
572 # source
573 linecache.checkcache()
573 linecache.checkcache()
574 source_success = False
574 source = None
575 try:
575 try:
576 try:
576 try:
577 src = getsource(obj,binary_file)
577 src = getsource(obj,binary_file)
@@ -581,10 +581,11 b' class Inspector:'
581 if src is not None:
581 if src is not None:
582 source = self.format(src)
582 source = self.format(src)
583 out['source'] = source.rstrip()
583 out['source'] = source.rstrip()
584 source_success = True
585 except Exception:
584 except Exception:
586 if ds:
585 pass
587 out['docstring'] = ds
586
587 if ds and source is None:
588 out['docstring'] = ds
588
589
589
590
590 # Constructor docstring for classes
591 # Constructor docstring for classes
General Comments 0
You need to be logged in to leave comments. Login now