Opened 8 years ago

Closed 8 years ago

Last modified 4 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: master
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@…> 8 years ago.
temporary_force_unicode_patch.patch (547 bytes) - added by Peter Klein <petkle@…> 8 years ago.
patch for 'elif not isinstance(s, unicode):'

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by Thomas Güttler <hv@…>

Changed 8 years ago by Peter Klein <petkle@…>

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

comment:1 Changed 8 years ago by Peter Klein <petkle@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 Changed 8 years ago by mir

  • Resolution set to wontfix
  • Status changed from new to closed

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 Changed 8 years ago by Thomas Güttler <hv@…>

  • Cc hv@… added

comment:4 Changed 4 years ago by guettli

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