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 <rep...@bugs.python.org> <http://bugs.python.org/issue1185124> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com