[Python-checkins] python/dist/src/Misc NEWS,1.851,1.852

tim_one at users.sourceforge.net tim_one at users.sourceforge.net
Sat Sep 6 21:30:20 EDT 2003


Update of /cvsroot/python/python/dist/src/Misc
In directory sc8-pr-cvs1:/tmp/cvs-serv14962/python/Misc

Modified Files:
	NEWS 
Log Message:
SF bug  801631:  file.truncate fault on windows.

file_truncate():  C doesn't define what fflush(fp) does if fp is open
for update, and the preceding I/O operation on fp was input.  On Windows,
fflush() actually changes the current file position then.  Because
Windows doesn't support ftruncate() directly, this not only caused
Python's file.truncate() to change the file position (contra our docs),
it also caused the file not to change size.

Repaired by getting the initial file position at the start, restoring
it at the end, and tossing all the complicated micro-efficiency checks
trying to avoid "provably unnecessary" seeks.  file.truncate() can't
be a frequent operation, and seeking to the current file position has
got to be cheap anyway.

Bugfix candidate.


Index: NEWS
===================================================================
RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v
retrieving revision 1.851
retrieving revision 1.852
diff -C2 -d -r1.851 -r1.852
*** NEWS	6 Sep 2003 19:52:12 -0000	1.851
--- NEWS	7 Sep 2003 03:30:16 -0000	1.852
***************
*** 95,98 ****
--- 95,102 ----
  -------
  
+ - file.truncate() could misbehave if the file was open for update
+   (modes r+, rb+, w+, wb+), and the most recent file operation before
+   the truncate() call was an input operation.  SF bug 801631.
+ 
  Mac
  ----





More information about the Python-checkins mailing list