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

Joe Gregorio joe at bitworking.org
Thu Jul 12 07:02:51 CEST 2007


I decided to try to tackle the unit tests failing on the py3k-struni branch for mmap. It now passes all the unit tests but one, and the problem is that I don't know what should be 'fixed'. The code in the unit test is:

     finally:
        try:
            f.close()
        except OSError:
            pass

The problem is that the file is already closed and in Lib/io.py, the close calls flush() and flush() raises ValueError() if the file is already closed, but the unit test is looking for OSError.

Should io.py raise OSError instead of ValueError? Or should test_mmap.py be expecting ValueError? Or is there something else that I'm completely missing?

[ The wisdom of choosing mmap as my first fiddling with Python internals can be debated later :) ]

Thanks, -joe

-- Joe Gregorio http://bitworking.org



More information about the Python-3000 mailing list