Opened 17 years ago

Closed 17 years ago

Last modified 13 years ago

#5028 closed Uncategorized (wontfix)

unicode: str(s) can fail if s is an AssertionError

Reported by: Thomas Güttler <hv@…> Owned by: nobody
Component: Uncategorized Version: dev
Severity: Normal Keywords: unicode
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Here is a small patch to fall back to repr() if
str() fails. (force_unicode())

str(exc) fails if the assertion message contains latin1.

Attachments (2)

utils_encoding_repr.diff (569 bytes ) - added by Thomas Güttler <hv@…> 17 years ago.
temporary_force_unicode_patch.patch (547 bytes ) - added by Peter Klein <petkle@…> 17 years ago.
patch for 'elif not isinstance(s, unicode):'

Download all attachments as: .zip

Change History (6)

by Thomas Güttler <hv@…>, 17 years ago

Attachment: utils_encoding_repr.diff added

by Peter Klein <petkle@…>, 17 years ago

patch for 'elif not isinstance(s, unicode):'

comment:1 by Peter Klein <petkle@…>, 17 years ago

I had the same problem with force_unicode() if s contains latin-1 characters, but in a different case. The patch only works for latin-1 systems, so you probably have to find a cleaner solution.

comment:2 by Michael Radziej, 17 years ago

Resolution: wontfix
Status: newclosed

It does absolutely make no sense to use repr() instead of str() if latter fails. Please discuss this in the developers' mailing list if you disagree.

comment:3 by Thomas Güttler <hv@…>, 17 years ago

Cc: hv@… added

comment:4 by Thomas Güttler, 13 years ago

Cc: hv@… removed
Easy pickings: unset
Severity: Normal
Type: Uncategorized
UI/UX: unset
Note: See TracTickets for help on using tickets.
Back to Top