Message198292
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. |
|
Date |
User |
Action |
Args |
2013-09-22 17:29:45 | sunfinite | set | recipients:
+ sunfinite, ping, ncoghlan, kjohnson, brianvanden, ajaksu2, eric.araujo, akitada, mpg |
2013-09-22 17:29:45 | sunfinite | set | messageid: <1379870985.77.0.789178580422.issue1185124@psf.upfronthosting.co.za> |
2013-09-22 17:29:45 | sunfinite | link | issue1185124 messages |
2013-09-22 17:29:45 | sunfinite | create | |
|