[ python-Bugs-853963 ] Implement lazy read for sockets

SourceForge.net noreply at sourceforge.net
Thu Dec 4 05:57:57 EST 2003


Bugs item #853963, was opened at 2003-12-04 11:57
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=853963&group_id=5470

Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Samuel Tardieu (samtardieu)
Assigned to: Nobody/Anonymous (nobody)
Summary: Implement lazy read for sockets

Initial Comment:
When a socket is transformed into a file object using
the makefile() method, the resulting object read()
behaviour requires that read(N)
returns N characters or that the end of stream be reached.

This causes problems with XML parsers which call
read(BufferSize) to
get "something", not necessarily a full buffer.

The following patch adds a "lazy" attribute to each
socket._fileobject
instance, the default being set to False in order to be
backward
compatible. If this attribute is set to True, read(N)
will return at least
one character unless the end of stream is reached, and
no more than
N characters.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=853963&group_id=5470



More information about the Python-bugs-list mailing list