summaryrefslogtreecommitdiff
path: root/bs4/__init__.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2021-12-17 12:54:14 -0500
committerLeonard Richardson <leonardr@segfault.org>2021-12-17 12:54:14 -0500
commit854fd52ad616d8e9c0860bba2eb4ddd93eb2dc79 (patch)
tree419c15e1c024ea09fc71efbc6d56014ae099fe52 /bs4/__init__.py
parentad52722cc6b55ce414d395e9a0860cee57c0ab2d (diff)
Fix a crash when pickling a BeautifulSoup object that has no
tree builder. [bug=1934003]
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 ddf1a86..75c801c 100644
--- a/bs4/__init__.py
+++ b/bs4/__init__.py
@@ -396,7 +396,7 @@ class BeautifulSoup(Tag):
def __getstate__(self):
# Frequently a tree builder can't be pickled.
d = dict(self.__dict__)
- if 'builder' in d and not self.builder.picklable:
+ if 'builder' in d and d['builder'] is not None and not self.builder.picklable:
d['builder'] = None
return d