diff options
author | Leonard Richardson <leonardr@segfault.org> | 2015-06-28 15:58:48 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2015-06-28 15:58:48 -0400 |
commit | 32a5c938876ec53a56ca22ff93ef645a659db9d5 (patch) | |
tree | 0139849de146d446ecc5765bd9bbdb6f0ae490a8 /bs4/builder | |
parent | d72ccb86dd2ff3dac56beb8fedcfaab7f804ce3a (diff) | |
download | beautifulsoup4-32a5c938876ec53a56ca22ff93ef645a659db9d5.tar.gz |
It's now possible to pickle a BeautifulSoup object no matter which
tree builder was used to create it. However, the only tree builder
that survives the pickling process is the HTMLParserTreeBuilder
('html.parser'). If you unpickle a BeautifulSoup object created with
some other tree builder, soup.builder will be None. [bug=1231545]
Diffstat (limited to 'bs4/builder')
-rw-r--r-- | bs4/builder/__init__.py | 1 | ||||
-rw-r--r-- | bs4/builder/_htmlparser.py | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/bs4/builder/__init__.py b/bs4/builder/__init__.py index 820bc80..f8fce56 100644 --- a/bs4/builder/__init__.py +++ b/bs4/builder/__init__.py @@ -85,6 +85,7 @@ class TreeBuilder(object): features = [] is_xml = False + picklable = False preserve_whitespace_tags = set() empty_element_tags = None # A tag will be considered an empty-element # tag when and only when it has no contents. diff --git a/bs4/builder/_htmlparser.py b/bs4/builder/_htmlparser.py index 25811f1..0101d64 100644 --- a/bs4/builder/_htmlparser.py +++ b/bs4/builder/_htmlparser.py @@ -127,6 +127,7 @@ class BeautifulSoupHTMLParser(HTMLParser): class HTMLParserTreeBuilder(HTMLTreeBuilder): is_xml = False + picklable = True NAME = HTMLPARSER features = [NAME, HTML, STRICT] |