<div class="gmail_quote">On Sat, Dec 10, 2011 at 5:30 PM, Terry Reedy <span dir="ltr">&lt;<a href="mailto:tjreedy@udel.edu">tjreedy@udel.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Is doctest really insisting that the whole line<br>
  Traceback (most recent call last):<br>
exactly match, with nothing added? It really should not, as that is not part of the language spec. This seems like the tail wagging the dog.<br></blockquote><div><br></div><div>It&#39;s a regular expression match, actually.  The standard matcher ignores everything between the Traceback line (matched by a regex) and the first unindented line that follows in the doctest.  However, if you explicitly try to match a traceback with the ellipsis matcher, intending to observe whether certain specific lines are printed, then you wouldn&#39;t be using doctest&#39;s built-in matcher, and that was the case I was concerned about.</div>
<div><br></div><div>However, as it turns out, I was confused about when this latter case occurs: in order to do it, you have to actually intentionally print a traceback (e.g. via traceback.format_exception() and friends), rather than allowing the exception to propagate normally.  This doesn&#39;t happen nearly as often in my doctests as I thought it did, but if format_exception() changes it&#39;ll still affect some people.</div>
<div><br></div><div>The other piece I was pointing out was that if you change the message without changing the doctest regex, then pasting an interpreter transcript into a doctest will no longer work, because doctest will think it&#39;s trying to match non-error output.  So that has to be changed when the exception format changes.</div>
<div><br></div><div>So, no actual objection here; just saying that if you don&#39;t change that regex, people who create *new* doctests with tracebacks won&#39;t be able to get them to work without deleting the version info from their copy-pasted tracebacks.  I was also concerned about a situation that, while it exists, does not occur anywhere near as frequently as I thought it would in my own tests, even for things that seriously abuse Python internals and likely can&#39;t be ported to Python 3 anyway.  ;-)</div>
<div><br></div></div>