[Python-3000] test_mmap.py and OSError (original) (raw)

Guido van Rossum guido at python.org
Thu Jul 12 09:02:29 CEST 2007


On 7/12/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:

Joe Gregorio wrote: > flush() raises > ValueError() if the file is already closed, > > Should io.py raise OSError instead of ValueError?

Is it really necessary to raise anything at all? An already-closed file is as flushed as it can get, so why not just let it be a no-op?

I like that much better. So close() shouldn't try to flush() if it's already closed. This means fixing io.py. (Unfortunately it's a bit of a mess, a bit of refactoring would do it good.)

BTW whenever changing io.py, always run both test_io.py and test_file.py, as they test slightly different sets of behavior. (Though occasionally these tests must be adjusted too.)

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



More information about the Python-3000 mailing list