Opened 15 years ago
Closed 15 years ago
#13029 closed (invalid)
Exception Value is empty with a HTMLParser.HTMLParseError
Reported by: | jedie | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | dev |
Severity: | Keywords: | traceback | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In the settings.DEBUG Traceback page is the Exception Value empty if a HTMLParser.HTMLParseError was raised.
e.g.: Put this in a view:
from HTMLParser import HTMLParseError raise HTMLParseError("FooBar Error message", (1, 2))
Normaly, the exception value should be:
FooBar Error message, at line 1, column 3
Change History (3)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
I'll call this accepted on the basis of Karen's remarks.
comment:3 by , 15 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
I tried this with Python 2.6.5rc1 and the problem doesn't exist there either. Based on that, I don't think it's necessary for us to put a workaround for a Python bug into Django code for this. In a couple of weeks upgrading to the latest Python 2.6 will make the problem go away.
This appears to be a Python2.6-only problem. 2.4, 2.5, and 2.7 (alpha 2) all display a non-empty Exception Value for these exceptions. For some reason I have not tracked down, on Python 2.6.4,
unicode()
applied to one of these exceptions produces an empty string. On earlier Pythons we don't attempt to applyunicode()
to the exception since it doesn't have a__unicode__
attribute -- we display essentiallyunicode(str(e))
wheree
is the exception. On 2.7 alpha 2 some change has been made so thatunicode(e)
for one of these gets routed to the HTMLParseError__str__
override. Possibly whatever change in Python that did that will also appear in the next release of 2.6, but since I haven't tracked down what change in Python is responsible for the difference I can't say that for sure.I'm tempted to close this as invalid since it's really looking to me like a bug in Python, not Django. But these sorts of failures to display debug info are pretty annoying, so if there's something we could do to fix it in Django maybe we should. I'm just not sure what that would be.