[Python-bugs-list] [ python-Bugs-548845 ] pydoc doesn't show C types
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 25 Apr 2002 15:58:03 -0700
Bugs item #548845, was opened at 2002-04-25 14:58
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=548845&group_id=5470
Category: Python Library
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Greg Chapman (glchapman)
Assigned to: Nobody/Anonymous (nobody)
Summary: pydoc doesn't show C types
Initial Comment:
If you define a type in C and add it to a module's
dictionary, it will not be displayed by pydoc. Now
that calling such types can serve as the constructor
for the type's instances, I think pydoc should ensure
that the types are displayed.
Pydoc sees such types as classes because
inspect.isclass returns true for them:
def isclass(object):
return isinstance(object, types.ClassType) or
hasattr(object, '__bases__')
(The above succeeds for because C types have a
__bases__ attribute). However, when pydoc checks to
see if the type/class is defined in the module being
documented, it uses the type's __module__ attribute to
look up the module in sys.modules. By default, C
types always return "__builtin__" as their __module__,
so pydoc concludes the type was actually declared in
the __builtin__ module and does not show it.
(Perhaps this is really a documentation bug -- there
does not seem to be anything indicating that types
which wish to expose themselves to pydoc should
redefine the __module__ attribute.)
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=548845&group_id=5470