Author onealj
Recipients onealj, stefan.richthofer
Date 2017-02-27.11:21:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
calls pydoc.doc(module, 'Help on %s:')
calls pydoc.render_doc(module, title='Help on %s:', forceload=0)
calls pydoc.text.document(module, modulename)

Which will only add the docstring if the object is a module. Since inspect identifies modules implemented in Java as classes instead of modules, the module section is not created for Java classes.

inspect.ismodule(urllib) == True #a pure python module
inspect.ismodule(_imp) == False #a java implemented module/class
inspect.isclass(_imp) == True

A quick hack of writing a module section when the object is either a module or a class fixed the missing docstring for Java docs, but likely has negative consequences for Python classes (both old and new style).

diff -r 0d2b840f6df8 Lib/
--- a/Lib/      Mon Feb 27 01:22:01 2017 +0100
+++ b/Lib/      Mon Feb 27 03:13:18 2017 -0800
@@ -329,7 +331,7 @@
         if inspect.ismemberdescriptor(object): return self.docdata(*args)
             if inspect.ismodule(object): return self.docmodule(*args)
-            if inspect.isclass(object): return self.docclass(*args)
+            if inspect.isclass(object): return self.docmodule(*args)
             if inspect.isroutine(object): return self.docroutine(*args)
         except AttributeError:

I'm leaning towards fixing inspect.ismodule and inspect.isclass to identify Java static (all static fields, private constructor, shouldn't have instances) classes as modules. Thoughts?
Date User Action Args
2017-02-27 11:21:54onealjsetmessageid: <>
2017-02-27 11:21:54onealjsetrecipients: + onealj, stefan.richthofer
2017-02-27 11:21:54onealjlinkissue2545 messages
2017-02-27 11:21:54onealjcreate