This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sunfinite
Recipients ajaksu2, akitada, brianvanden, eric.araujo, kjohnson, mpg, ncoghlan, ping, sunfinite
Date 2013-09-22.17:29:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1379870985.77.0.789178580422.issue1185124@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-09-22 17:29:45sunfinitesetrecipients: + sunfinite, ping, ncoghlan, kjohnson, brianvanden, ajaksu2, eric.araujo, akitada, mpg
2013-09-22 17:29:45sunfinitesetmessageid: <1379870985.77.0.789178580422.issue1185124@psf.upfronthosting.co.za>
2013-09-22 17:29:45sunfinitelinkissue1185124 messages
2013-09-22 17:29:45sunfinitecreate