Only use custom subclass of HTMLParser for Python versions with buggy stdlib HTMLParser
|Reported by:||Carl Meyer||Owned by:||nobody|
|Cc:||Raphaël Hertzog||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Django currently has its own subclass of
django.utils.html_parser.HTMLParser). It exists in order to patch a bug in the standard library's
HTMLParser in Python 2.5 and older versions of 2.6 and 2.7. The bug has been fixed in Python 2.6.8, 2.7.3, and will be fixed in the upcoming 3.3 as well. There are also other fixes in 3.3's
HTMLParser which conflict with the patched version in Django, since it relies on numerous undocumented internals.
For better forward-compatibility, we should only use our patched subclass for versions of Python known to contain the bug, and otherwise simply use the standard library's
When we make this change, we can also roll back r17456, as that was simply papering over a breakage due to the modified
HTMLParser in 2.6.8 and 2.7.3 - that will no longer be a problem if we don't try to use our subclass with those (and newer) Pythons.