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 mjpieters
Recipients kbk, mjpieters, ned.deily, python-dev, roger.serwy, serhiy.storchaka, terry.reedy, tim.peters
Date 2015-03-04.14:54:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1425480878.75.0.491044285485.issue19481@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-03-04 14:54:38mjpieterssetrecipients: + mjpieters, tim.peters, terry.reedy, kbk, ned.deily, roger.serwy, python-dev, serhiy.storchaka
2015-03-04 14:54:38mjpieterssetmessageid: <1425480878.75.0.491044285485.issue19481@psf.upfronthosting.co.za>
2015-03-04 14:54:38mjpieterslinkissue19481 messages
2015-03-04 14:54:38mjpieterscreate