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 jneb
Recipients jneb, r.david.murray
Date 2015-10-22.07:14:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1445498087.75.0.555088069786.issue24925@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-10-22 07:14:47jnebsetrecipients: + jneb, r.david.murray
2015-10-22 07:14:47jnebsetmessageid: <1445498087.75.0.555088069786.issue24925@psf.upfronthosting.co.za>
2015-10-22 07:14:47jneblinkissue24925 messages
2015-10-22 07:14:47jnebcreate