summaryrefslogtreecommitdiff
path: root/bs4/__init__.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2016-07-17 14:34:41 -0400
committerLeonard Richardson <leonardr@segfault.org>2016-07-17 14:34:41 -0400
commitddd96837409420b6b9d301a6e6d83674c43d9855 (patch)
tree77fb23e61be72082f2a627c691bba5b77c7df59a /bs4/__init__.py
parent77aee72327446bace1a8cd6b66a41eed15ada337 (diff)
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]
Diffstat (limited to 'bs4/__init__.py')
-rw-r--r--bs4/__init__.py2
1 files changed, 1 insertions, 1 deletions
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