#5046 closed Cleanup/optimization (fixed)
views/debug.py: Display string of UnicodeError
| Reported by: | Owned by: | Adrian Holovaty | |
|---|---|---|---|
| Component: | Error reporting | Version: | dev |
| Severity: | Normal | Keywords: | unicode |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Hi,
if you get an UnicodeError in debug.py you don't see
the string, which contains the non utf8 character.
This small patch adds a hint, if the exception is an UnicodeError.
The hint displays some character before and after the wrong
character.
Attachments (2)
Change History (9)
by , 18 years ago
| Attachment: | views_debug_unicodeerror_hint.diff added |
|---|
comment:3 by , 18 years ago
| Component: | Uncategorized → Metasystem |
|---|---|
| Owner: | changed from to |
comment:5 by , 18 years ago
| Triage Stage: | Unreviewed → Ready for checkin |
|---|
by , 18 years ago
| Attachment: | views_debug_unicodeerror_hint.2.diff added |
|---|
comment:6 by , 18 years ago
comment:7 by , 18 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:8 by , 8 years ago
| Component: | Metasystem → Error reporting |
|---|---|
| Easy pickings: | unset |
| Severity: | → Normal |
| Type: | → Cleanup/optimization |
| UI/UX: | unset |
10 years later, I noticed these lines aren't tested. I'm not sure if this feature is still needed in a Python 3-only world as I'd think the problematic string would appear in the " Local vars" section of the traceback but there aren't steps to reproduce so perhaps you could give an insight if you remember anything about the original issue, Thomas?
In case the feature in still useful, I made a PR to add a test.
the second diff (views_debug_unicodeerror_hint.2.diff) fixes a typo of
the first diff: smart_unicode(..., errors="replace")