Join GitHub today
Use str to get the exception message #3912
@berkerpeksag I take the
I check for an exception with non-ascii characters, this is what a found
With the imported str an exception happens. So, are we fine just removing the import?
I think using future and their implicit imports to do this is a bit bad idea. Even without using its implicit conversation, it's possible to get a
>>> e = Exception(u'ıçğü') >>> str(e) Traceback (most recent call last): File "<stdin>", line 1, in <module> UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
(Since Django and other libraries use unicode to store data internally, the chance of getting a unicode
I'd be more conservative and don't do this until we get rid of Python 2, but of course this is just my opinion. If we decide to get this in, it would be nice to check if we reach 100% branch coverage (including adding tests for the
I'd prefer to see some tests here, it seems we're disregarding some of our use cases of exceptions here.
More specifically, exceptions that use
I agree on holding off here until this either has tests or we're closer to python 3.
Are you referring to a code that uses
At least an exception change the