Patches item #853963, was opened at 2003-12-04 11:57 Message generated for change (Comment added) made by loewis You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=853963&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Rejected Priority: 5 Private: No 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. ---------------------------------------------------------------------- >Comment By: Martin v. Löwis (loewis) Date: 2006-11-25 16:30 Message: Logged In: YES user_id=21627 Originator: NO It seems there is very little interest in this patch; it also has a few problems: - it does not include changes to the documentation and the test suite - the feature can be implemented in a fairly easy way by inheriting from _fileobject; you just have to delegate read() nearly directly to recv. - [IMO] "lazy" is a bad name for this feature; it has more to do with whether it is blocking or not. - I don't believe the patch can solve the original problem in all cases: it very much depends on how often the XML parser invokes .read() For these reasons, I'm rejecting the patch. ---------------------------------------------------------------------- Comment By: Samuel Tardieu (samtardieu) Date: 2003-12-04 12:47 Message: Logged In: YES user_id=131394 Note: the original problem description came by Pierre Palatin <[EMAIL PROTECTED]>. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=853963&group_id=5470 _______________________________________________ Patches mailing list Patches@python.org http://mail.python.org/mailman/listinfo/patches