beautifulsoup pickle dict bytestream discrepancy
Bug #995733 reported by
Toby Borland
This bug report is a duplicate of:
Bug #682685: BeautifulSoup strings don't implement __deepcopy__.
Edit
Remove
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Beautiful Soup |
New
|
Undecided
|
Unassigned |
Bug Description
Python dictionaries created using output from BeautifulSoup4.0.4 are incorrectly pickled to bytestream under Python3.2.2 causing a runtime exception on PythonWin under Windows XP SP3 x86.
This problem will not manifest when the bytestream is unpickled. See attached script for problem recreation.
To post a comment you must log in.
I can't duplicate the error, but I'm not on Windows. I believe the
problem is real, but I have no idea how to go about diagnosing or
fixing it.
I would not expect pickle. dumps(D_ type) to equal pickle. dumps({ 'bug': body.string is a NavigableString and 'bug'
'test'}), because BS4_test.
is a string. When you pickle a NavigableString you are pickling the
entire Beautiful Soup tree to which it is connected.
This is inefficient, but it should work without giving a RuntimeError. body.string) when you remove it from a Beautiful Soup
A more efficient technique, and one you can probably use as a
workaround, is to convert the NavigableString into a normal string
with str(soup.
context.
Is your RuntimeError the same one seen here?
http:// groups. google. com/group/ beautifulsoup/ browse_ thread/ thread/ acc192642652aa4 f
If you're up to it, you could run the unit test suite on Windows and
see what results you get.
> Python dictionaries created using output from BeautifulSoup4.0.4 are incorrectly pickled to bytestream under Python3.2.2 causing a runtime exception on PythonWin under Windows XP SP3 x86. /bugs.launchpad .net/bugs/ 995733 /bugs.launchpad .net/beautifuls oup/+bug/ 995733/ +subscriptions
> This problem will not manifest when the bytestream is unpickled. See attached script for problem recreation.
>
> ** Affects: beautifulsoup
> Importance: Undecided
> Status: New
>
> --
> You received this bug notification because you are subscribed to
> Beautiful Soup.
> https:/
>
> Title:
> beautifulsoup pickle dict bytestream discrepancy
>
> To manage notifications about this bug go to:
> https:/