summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS.txt5
-rw-r--r--bs4/__init__.py2
2 files changed, 6 insertions, 1 deletions
diff --git a/NEWS.txt b/NEWS.txt
index 055cc6a..572ad65 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -12,6 +12,11 @@
* The contents of <textarea> tags will no longer be modified when the
tree is prettified. [bug=1555829]
+* When a BeautifulSoup object is pickled but its tree builder cannot
+ be pickled, its .builder attribute is set to None instead of being
+ destroyed. This avoids a performance problem once the object is
+ unpickled. [bug=1523629]
+
* Specify the file and line number when warning about a
BeautifulSoup object being instantiated without a parser being
specified. [bug=1574647]
diff --git a/bs4/__init__.py b/bs4/__init__.py
index d865bb9..bc611c9 100644
--- a/bs4/__init__.py
+++ b/bs4/__init__.py
@@ -242,7 +242,7 @@ class BeautifulSoup(Tag):
# Frequently a tree builder can't be pickled.
d = dict(self.__dict__)
if 'builder' in d and not self.builder.picklable:
- del d['builder']
+ d['builder'] = None
return d
@staticmethod