Patches item #1397960, was opened at 2006-01-05 19:18 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1397960&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: Core (C code) Group: None Status: Open Resolution: None Priority: 5 Submitted By: Thomas Wouters (twouters) Assigned to: Nobody/Anonymous (nobody) Summary: File-iteration and read* method protection Initial Comment: This patch causes the readline, readlines, read and readinto methods of file objects (as well as PyFile_ReadLine() called on actual fileobjects) to raise an exception if (and only if) there is data in the file-iteration buffer. Currently, if any of these methods are called during file-iteration (with a non-empty buffer), the read* methods return data following the buffer, causing the data to seem out of order. Or, if all of the file's remaining data is in the buffer, truncated. The patch is only supposed to raise an error when, previously, the file's data would get corrupted. It doesn't prevent mixing iteration and read*-methods in harmless situations (methods followed by iteration, iteration until EOF followed by methods, or iteration until an exact buffer boundary, followed by methods.) The exception currently raised is ValueError, because it seems least inappropriate. Also, read* on closed files raises ValueError (probably for the same reason.) The test_file test has been ammended to include tests for this behaviour. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1397960&group_id=5470 _______________________________________________ Patches mailing list [email protected] http://mail.python.org/mailman/listinfo/patches
