diff options
author | Leonard Richardson <leonardr@segfault.org> | 2021-02-13 10:46:53 -0500 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2021-02-13 10:46:53 -0500 |
commit | 4d8d9af1c841d1eec0e9e838a467579831268b8b (patch) | |
tree | b12125a543029481a02c69e96cc1b947af63b374 /bs4/__init__.py | |
parent | 0986e7bb25c46c2c9c1787e474e81de157ecfedf (diff) |
Performance improvement when processing tags that speeds up overall
tree construction by 2%. Patch by Morotti. [bug=1899358]
Diffstat (limited to 'bs4/__init__.py')
-rw-r--r-- | bs4/__init__.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/bs4/__init__.py b/bs4/__init__.py index e33f62a..3714d67 100644 --- a/bs4/__init__.py +++ b/bs4/__init__.py @@ -553,9 +553,7 @@ class BeautifulSoup(Tag): def endData(self, containerClass=None): """Method called by the TreeBuilder when the end of a data segment occurs. - """ - containerClass = self.string_container(containerClass) - + """ if self.current_data: current_data = u''.join(self.current_data) # If whitespace is not preserved, and this string contains @@ -582,6 +580,7 @@ class BeautifulSoup(Tag): not self.parse_only.search(current_data)): return + containerClass = self.string_container(containerClass) o = containerClass(current_data) self.object_was_parsed(o) |