This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xtreak
Recipients berker.peksag, ezio.melotti, kodial, xtreak
Date 2019-12-18.09:07:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1576660040.16.0.155897286355.issue34480@roundup.psfhosted.org>
In-reply-to
Content
Attaching a test case for this issue since the self.error code path was not covered in the current test suite. A PR is open proposing match variable initialisation with None https://github.com/python/cpython/pull/17643 .

diff --git Lib/test/test_htmlparser.py Lib/test/test_htmlparser.py
index a2bfb39d16..a9aff11706 100644
--- Lib/test/test_htmlparser.py
+++ Lib/test/test_htmlparser.py
@@ -766,6 +766,18 @@ class AttributesTestCase(TestCaseBase):
                           [("href", "http://www.example.org/\">;")]),
                          ("data", "spam"), ("endtag", "a")])
 
+    def test_invalid_keyword_error_exception(self):
+        class InvalidMarkupException(Exception):
+            pass
+
+        class MyHTMLParser(html.parser.HTMLParser):
+
+            def error(self, message):
+                raise InvalidMarkupException(message)
+
+        parser = MyHTMLParser()
+        with self.assertRaises(InvalidMarkupException):
+            parser.feed('<![invalid>')
 
 if __name__ == "__main__":
     unittest.main()
History
Date User Action Args
2019-12-18 09:07:20xtreaksetrecipients: + xtreak, ezio.melotti, berker.peksag, kodial
2019-12-18 09:07:20xtreaksetmessageid: <1576660040.16.0.155897286355.issue34480@roundup.psfhosted.org>
2019-12-18 09:07:20xtreaklinkissue34480 messages
2019-12-18 09:07:20xtreakcreate