New submission from Devin Jeanpierre <jeanpierr...@gmail.com>: >From the doctest source:
'Option directives are comments starting with "doctest:". Warning: this may give false positives for string-literals that contain the string "#doctest:". Eliminating these false positives would require actually parsing the string; but we limit them by ignoring any line containing "#doctest:" that is *followed* by a quote mark.' This isn't a huge deal, but it's a bit annoying. Above being confusing, this is in contradiction with the doctest documentation, which states: 'Doctest directives are expressed as a special Python comment following an example’s source code' No mention is made of this corner case where the regexp breaks. As per the comment in the source, the patched version parses the source using the tokenize module, and runs a modified directive regex on all comment tokens to find directives. ---------- components: Library (Lib) files: comments.diff keywords: patch messages: 134278 nosy: Devin Jeanpierre priority: normal severity: normal status: open title: Doctest sees directives in strings when it should only see them in comments Added file: http://bugs.python.org/file21757/comments.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11909> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com