[issue1185124] pydoc doesn't find all module doc strings

Sunny report at bugs.python.org
Sun Sep 22 19:29:45 CEST 2013


Sunny added the comment:

I've rewritten the source_synopsis function to use the tokenize module. 

It should now work with triple single quotes and hopefully all the other cases where __doc__ returns a string.

Since tokenize.tokenize needs a file object that is opened in binary mode, in the case of a StringIO object, i am reading the whole  object and converting it to a BytesIO object. I don't know if that is the right way. Also, the only instance i could find where source_synopsis is called with a StringIO object is in the ModuleScanner.run method. Maybe we could tweak this call to pass a byte-stream object to avoid the overhead of re-conversion?

All the current tests pass.

----------
keywords: +patch
nosy: +sunfinite
Added file: http://bugs.python.org/file31844/myfirst.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1185124>
_______________________________________


More information about the Python-bugs-list mailing list