Code

Opened 4 years ago

Closed 4 years ago

#13029 closed (invalid)

Exception Value is empty with a HTMLParser.HTMLParseError

Reported by: jedie Owned by: nobody
Component: Uncategorized Version: master
Severity: Keywords: traceback
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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

Attachments (0)

Change History (3)

comment:1 Changed 4 years ago by kmtracey

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

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 apply unicode() to the exception since it doesn't have a __unicode__ attribute -- we display essentially unicode(str(e)) where e is the exception. On 2.7 alpha 2 some change has been made so that unicode(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.

comment:2 Changed 4 years ago by russellm

  • Triage Stage changed from Unreviewed to Accepted

I'll call this accepted on the basis of Karen's remarks.

comment:3 Changed 4 years ago by kmtracey

  • Resolution set to invalid
  • Status changed from new to 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.