[Python-checkins] CVS: python/dist/src/Lib/test test_largefile.py,1.7,1.8

Guido van Rossum guido@python.org
Thu, 06 Sep 2001 05:01:02 -0400


> Dubious assumptions:
> 
> 1. That seeking beyond the end of a file increases the size of a file.

I haven't seen the code that alledgedly made this assumption, but the
Unix/Posix rule is actually subtly different: seeking beyond the end
of a file *and then writing* increases the size of the file.

> 2. That files so extended are magically filled with null bytes.
> 
> I find no support for either in the C std, and #2 in particular turns out
> not to be true on Win32 (you apparently see whatever trash happened to be
> on disk).  Left #1 intact, but changed the test to check only bytes it
> explicitly wrote.  Also fiddled the "expected" vs "got" failure reports
> to consistently use repr (%r) -- they weren't readable otherwise.

Interesting.  This is worth knowing -- the "fill with null bytes" is
holy dogma on Unix.

--Guido van Rossum (home page: http://www.python.org/~guido/)