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 lregebro
Recipients lregebro
Date 2009-12-13.11:11:38
SpamBayes Score 1.5110135e-13
Marked as misclassified No
Message-id <1260702702.76.0.177643280777.issue7490@psf.upfronthosting.co.za>
In-reply-to
Content
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 `module.name.ExceptionClass` 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
example.

[2] http://mail.python.org/pipermail/python-dev/2009-December/094460.html
History
Date User Action Args
2009-12-13 11:11:42lregebrosetrecipients: + lregebro
2009-12-13 11:11:42lregebrosetmessageid: <1260702702.76.0.177643280777.issue7490@psf.upfronthosting.co.za>
2009-12-13 11:11:41lregebrolinkissue7490 messages
2009-12-13 11:11:40lregebrocreate