8000 [3.9] bpo-34480: fix bug where match variable is used prior to being defined (GH-17643) by mareksuscak · Pull Request #32256 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.9] bpo-34480: fix bug where match variable is used prior to being defined (GH-17643) #32256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 16, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add comments pointing to the bpo issue and remove whitespace.
  • Loading branch information
ezio-melotti authored Apr 6, 2022
commit ff38a95e48cad22013539d3f996b2a3b7f063877
14 changes: 5 additions & 9 deletions Lib/test/test_htmlparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,29 +788,25 @@ def test_weird_chars_in_unquoted_attribute_values(self):
[('action', 'bogus|&#()value')])])

def test_invalid_keyword_error_exception(self):
# bpo-34480: check that subclasses that define an
# error method that raises an exception work
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>')

def test_invalid_keyword_error_pass(self):
# bpo-34480: check that subclasses that define an
# error method that doesn't raise an exception work
class MyHTMLParser(html.parser.HTMLParser):

def error(self, message):
pass

parser = MyHTMLParser()
self.assertEqual(
parser.feed('<![invalid>'),
None
)
self.assertEqual(parser.feed('<![invalid>'), None)


if __name__ == "__main__":
Expand Down
0