Jurjen N.E. Bos added the comment: Oops. Lousy editing, I should have used return instead of break.
These 6 lines can be inserted in lib/doctest at line 1100: + if isinstance(obj, str) and source_lines is not None: + # This will find __test__ string doctests if and only if the string + # contains any unique line. + for offset,line in enumerate(obj.splitlines(keepends=True): + if source_lines.count(line)==1: + return source_lines.index(line)-offset And it works fine for me; the code is quite general and has predictable behaviour: any test string with a unique line in it will work. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24925> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com