From 0bbbb724a94203f156a01a2fbe680b969f4a75e9 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Sat, 7 Oct 2023 20:56:26 +0100 Subject: [PATCH] =?UTF-8?q?Update=20Beautiful=20Soup=204.12.2=20=E2=86=92?= =?UTF-8?q?=204.12.2=20(30c58a1).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 7 ++++++- lib/bs4/builder/_htmlparser.py | 2 +- lib/bs4/element.py | 7 ++++++- 3 files changed, 13 insertions(+), 3 deletions(-) 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.