Bug in cbook.exception_to_str() in v 1.2 #2104
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The exception_to_str() function was changed between mpl 1.1 and 1.2.
In my installation I show it going from this:
def exception_to_str(s = None):
to this:
def exception_to_str(s=None):
At first glance, the change seems innocuous enough, but I think it
introduced an error. (It appears that mpl 1.2 is supposed to work on
Python 2.7 and 3.x.) From a thread I started on comp.lang.python
(http://thread.gmane.org/gmane.comp.python.general/733938), it appears
that io.StringIO instances only accept Unicode strings as input.
Unless v 1.2 is only supposed to run on Python 3 (that doesn't seem to
be the case), you need to do something to convert the traceback
module's output to Unicode before feeding to the io.StringIO object.
Here's a simple demonstration of the problem:
% python2.7
Python 2.7.5+ (2.7:93eb15779050, May 30 2013, 15:27:39)
[GCC 4.4.6 [TWW]] on linux2
Type "help", "copyright", "credits" or "license" for more information.