diff options
author | Leonard Richardson <leonardr@segfault.org> | 2016-07-17 14:34:41 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2016-07-17 14:34:41 -0400 |
commit | ddd96837409420b6b9d301a6e6d83674c43d9855 (patch) | |
tree | 77fb23e61be72082f2a627c691bba5b77c7df59a | |
parent | 77aee72327446bace1a8cd6b66a41eed15ada337 (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]
-rw-r--r-- | NEWS.txt | 5 | ||||
-rw-r--r-- | bs4/__init__.py | 2 |
2 files changed, 6 insertions, 1 deletions
@@ -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 |