New submission from Lennart Regebro <rege...@gmail.com>: 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 ---------- components: Tests files: python-py3k-exception-detail.diff keywords: patch messages: 96329 nosy: lregebro severity: normal status: open title: IGNORE_EXCEPTION_DETAIL should ignore the module name type: behavior versions: Python 2.7, Python 3.1 Added file: http://bugs.python.org/file15537/python-py3k-exception-detail.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7490> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com