Author lregebro
Recipients lregebro
Date 2009-12-13.11:11:38
SpamBayes Score 1.51101e-13
Marked as misclassified No
Message-id <>
In Python 3.x [1] the exception formatting prints the module path, while
under 2.x it prints only the exception class name. This makes it very
tricky to make doctests that pass under both Python 2 and Python 3
without resorting to ugly tricks.

Since IGNORE_EXCEPTION_DETAIL was implemented to hide differences
between exception messages in 2.3 and 2.4, it was suggested on
python-dev [2] that IGNORE_EXCEPTION_DETAIL should be extended to also
ignore the module name, so that `` and
`ExceptionClass` would match each other. This is easily done by just
changing the regexp that is done for matching.

I'll attach diffs both for trunk and for py3k-branch, so that both forms
can be used on both versions. The diffs include tests and suggested
documentation changes (although I reserve the right to be useless at
writing documentation).

[1] And possibly in some cases under Python 2.7 according to reports in
the thread on python-dev about this issue, although I haven't been able
to confirm this. I'll include a 2.7 diff anyway, as it would be good if
both syntaxes work under both versions, if people start using 3to2, for

Date User Action Args
2009-12-13 11:11:42lregebrosetrecipients: + lregebro
2009-12-13 11:11:42lregebrosetmessageid: <>
2009-12-13 11:11:41lregebrolinkissue7490 messages
2009-12-13 11:11:40lregebrocreate