diff --git a/CHANGES.md b/CHANGES.md index be1f0eaa..188fa925 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,9 @@ -### 3.30.1 (2023-10-02 22:50:00 UTC) +### 3.31.0 (2023-1x-xx xx:xx:00 UTC) + +* Update Beautiful Soup 4.12.2 to 4.12.2 (30c58a1) + + +### 3.30.1 (2023-10-02 22:50:00 UTC) * Change allow Python 3.12.0 and 3.11.6 diff --git a/lib/bs4/builder/_htmlparser.py b/lib/bs4/builder/_htmlparser.py index 4c5ced93..59911043 100644 --- a/lib/bs4/builder/_htmlparser.py +++ b/lib/bs4/builder/_htmlparser.py @@ -378,10 +378,10 @@ class HTMLParserTreeBuilder(HTMLTreeBuilder): parser.soup = self.soup try: parser.feed(markup) + parser.close() except AssertionError as e: # html.parser raises AssertionError in rare cases to # indicate a fatal problem with the markup, especially # when there's an error in the doctype declaration. raise ParserRejectedMarkup(e) - parser.close() parser.already_closed_empty_element = [] diff --git a/lib/bs4/element.py b/lib/bs4/element.py index 99fc8137..38ca2dc2 100644 --- a/lib/bs4/element.py +++ b/lib/bs4/element.py @@ -1356,7 +1356,7 @@ class Tag(PageElement): This is the first step in the deepcopy process. """ clone = type(self)( - None, self.builder, self.name, self.namespace, + None, None, self.name, self.namespace, self.prefix, self.attrs, is_xml=self._is_xml, sourceline=self.sourceline, sourcepos=self.sourcepos, can_be_empty_element=self.can_be_empty_element, @@ -1845,6 +1845,11 @@ class Tag(PageElement): return space_before + s + space_after def _format_tag(self, eventual_encoding, formatter, opening): + if self.hidden: + # A hidden tag is invisible, although its contents + # are visible. + return '' + # A tag starts with the < character (see below). # Then the / character, if this is a closing tag.