Message169042
In Python 3.2 and earlier:
>>> str(ImportError(b'foo'))
"b'foo'"
In Python 3.3:
>>> str(ImportError(b'foo'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __str__ returned non-string (type bytes)
This appears to be due to commit 76272.
I'm attaching a patch which fixes it, though perhaps ImportError should type-check the arguments
Motivation:
This leads to a failure of the test suite for "docutils" when run under Python 3.3 betas, specifically:
======================================================================
ERROR: test_unicode (test_error_reporting.ErrorStringTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/david/coding/python3.3/docutils/trunk/docutils/test3/test_error_reporting.py", line 154, in test_unicode
str(ErrorString(ImportError(self.bs))))
File "/home/david/coding/python3.3/docutils/trunk/docutils/build/lib/docutils/utils/error_reporting.py", line 124, in __str__
super(ErrorString, self).__str__())
File "/home/david/coding/python3.3/docutils/trunk/docutils/build/lib/docutils/utils/error_reporting.py", line 74, in __str__
return str(self.data)
TypeError: __str__ returned non-string (type bytes)
See http://docutils.svn.sourceforge.net/viewvc/docutils/trunk/docutils/test/test_error_reporting.py?revision=7464&view=markup for the test code. Arguably docutils could just pick a different exception subclass. |
|
Date |
User |
Action |
Args |
2012-08-24 16:38:45 | dmalcolm | set | recipients:
+ dmalcolm, brett.cannon |
2012-08-24 16:38:45 | dmalcolm | set | messageid: <1345826325.41.0.0972765515738.issue15778@psf.upfronthosting.co.za> |
2012-08-24 16:38:44 | dmalcolm | link | issue15778 messages |
2012-08-24 16:38:44 | dmalcolm | create | |
|