From 0d77e157ce649e46f443d5fcc99dca93a6bcd2e9 2007-10-15 21:22:32 From: fperez Date: 2007-10-15 21:22:32 Subject: [PATCH] fix small bug seen with f2py-generated modules --- diff --git a/IPython/OInspect.py b/IPython/OInspect.py index f41f13a..f932beb 100644 --- a/IPython/OInspect.py +++ b/IPython/OInspect.py @@ -6,7 +6,7 @@ Uses syntax highlighting for presenting the various information elements. Similar in spirit to the inspect module, but all calls take a name argument to reference the name under which an object is being read. -$Id: OInspect.py 2723 2007-09-07 07:44:16Z fperez $ +$Id: OInspect.py 2843 2007-10-15 21:22:32Z fperez $ """ #***************************************************************************** @@ -473,7 +473,12 @@ class Inspector: # most cases they will, but it's nice to print all the info for # objects which use instance-customized docstrings. if ds: - class_ds = getdoc(obj.__class__) + try: + cls = getattr(obj,'__class__') + except: + class_ds = None + else: + class_ds = getdoc(cls) # Skip Python's auto-generated docstrings if class_ds and \ (class_ds.startswith('function(code, globals[,') or \ diff --git a/doc/ChangeLog b/doc/ChangeLog index 680ca49..476d0b1 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,9 @@ +2007-10-15 Fernando Perez + + * IPython/OInspect.py (Inspector.pinfo): fix bug that could arise + when querying objects with no __class__ attribute (such as + f2py-generated modules). + 2007-10-09 Fernando Perez * IPython/Magic.py (magic_time): track compilation time and report