This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author taleinat
Recipients gpolo, taleinat
Date 2009-03-29.15:59:18
SpamBayes Score 2.509104e-14
Marked as misclassified No
Message-id <1238342362.29.0.506569372271.issue1757057@psf.upfronthosting.co.za>
In-reply-to
Content
To recreate use BeautifulSoup 3.0.4 and run the following:

>>> from BeautifulSoup import BeautifulSoup
>>> soup = BeautifulSoup("<html>aa</html")
>>> x = soup.find('html').contents[0]
>>> x
u'aa'
>>> print x

Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    print x
RuntimeError: maximum recursion depth exceeded


This is caused by a bug in BeautifulSoup which was fixed in version
3.0.5. The bug manifests when trying to pickle an instance of the
NavigableString class.

In the above scenario, IDLE has the subprocess pickle the object and
send it to the parent process. Since the problem is with the pickling,
turning the object into a string in the subprocess (instead of sending
it as-is to the parent process) avoids generating the error:

>>> print str(x)
aa
>>> print repr(x)
u'aa'


To verify that pickle is the culprit:
>>> import pickle
>>> pickle.dumps(x)
(very long traceback...)
RuntimeError: maximum recursion depth exceeded


Like I said in my first post, IMO IDLE should check for any exception
(not just pickle.PicklingError) when trying to pickle an object for
sending to the parent process. If pickle doesn't work, for whatever
reason, IDLE can still try to work around it with str() and/or repr().

(I tried this with Python 2.5 but I've tested this in the past with 2.6
as well. I haven't tried it with 3.0 or 2.7 yet.)
History
Date User Action Args
2009-03-29 15:59:22taleinatsetrecipients: + taleinat, gpolo
2009-03-29 15:59:22taleinatsetmessageid: <1238342362.29.0.506569372271.issue1757057@psf.upfronthosting.co.za>
2009-03-29 15:59:21taleinatlinkissue1757057 messages
2009-03-29 15:59:18taleinatcreate