Message5376

Author kurtmckee
Recipients kurtmckee
Date 2009-12-14.05:07:57
SpamBayes Score 2.820133e-12
Marked as misclassified No
Message-id <1260767278.89.0.437007837404.issue1523@psf.upfronthosting.co.za>
In-reply-to
Content
The xml.sax parser is receiving different read() buffer sizes with each
call. This is in contrast to the CPython implementation, which appears
to call read() with consistent buffer sizes. The following code
demonstrates the issue (I can't seem to create attachments, sorry):

import xml.sax
import StringIO      

class Catcher(StringIO.StringIO):
    def read(self, size):
        print size
        return StringIO.StringIO.read(self, size)

s = """<?xml version="1.0"?>\n<root version="2.0"/>"""

handler = xml.sax.handler.ContentHandler()
parser = xml.sax.make_parser()
parser.setContentHandler(handler)
parser.parse(Catcher(s))

Python 2.6 prints

"""
65516
65516
"""

Jython 2.5.1 prints

"""
1
1
1
1
28
8188
8192
"""

I read through the Jython xml.sax module source code but couldn't figure
out why this was happening.
History
Date User Action Args
2009-12-14 05:07:59kurtmckeesetrecipients: + kurtmckee
2009-12-14 05:07:58kurtmckeesetmessageid: <1260767278.89.0.437007837404.issue1523@psf.upfronthosting.co.za>
2009-12-14 05:07:58kurtmckeelinkissue1523 messages
2009-12-14 05:07:57kurtmckeecreate