[issue19481] IDLE hangs while printing instance of Unicode subclass
Martijn Pieters
report at bugs.python.org
Wed Mar 4 15:54:38 CET 2015
Martijn Pieters added the comment:
This changes causes printing BeautifulSoup NavigableString objects to fail; the code actually could never work as `unicode.__getslice__` insists on getting passed in integers, not None.
To reproduce, create a new file in IDLE and paste in:
from bs4 import BeautifulSoup
html_doc = """<title>The Dormouse's story</title>"""
soup = BeautifulSoup(html_doc)
print soup.title.string
Then pick *Run Module* to see:
Traceback (most recent call last):
File "/private/tmp/test.py", line 4, in <module>
print soup.title.string
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/idlelib/PyShell.py", line 1353, in write
s = unicode.__getslice__(s, None, None)
TypeError: an integer is required
The same error can be induced with:
unicode.__getslice__(u'', None, None)
while specifying a start and end index (0 and len(s)) should fix this.
----------
nosy: +mjpieters
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19481>
_______________________________________
More information about the Python-bugs-list
mailing list