[Python-3000] test_mmap.py and OSError

Joe Gregorio joe at bitworking.org
Mon Jul 16 20:45:05 CEST 2007


On 7/16/07, Guido van Rossum <guido at python.org> wrote:
> So, after seeing the patch and thinking this over some more, I have
> changed my mind (again). Attempting to flush a closed file seems to
> indicate that you're confused about whether a file is closed or not,
> and that seems indicative of unclear thinking, i.e. it's likely a bug
> that ought to be caught. I think the original thinking that lead to
> this being treated as an error in 2.x was correct.
>
> I don't see attempts to close an already closed file the same way --
> this is a state transition to a final state and it makes total sense
> that you can reach that state from itself. There are good use cases
> for allowing this. I don't see the use case for flushing a closed
> file.

Personally I like that better, it seems more consistent.

Should I change the try/except block in the mmap unit test to look for
ValueError or should the exception raised in io.py be of type OSError like
the 2.5 code expects?

test_mmap.py:108

            try:
                f.close()
            except OSError:
                pass

   Thanks,
   -joe

-- 
Joe Gregorio        http://bitworking.org


More information about the Python-3000 mailing list