Interesting.
Looks like a bug, really.  It's the only function that sets IOError.  All 
others use posix_error which raises an OSError.
Maybe tests are a good thing, then?
Kristján

-----Original Message-----
From: Mark Dickinson [mailto:dicki...@gmail.com] 
Sent: 15. janúar 2009 17:01
To: Kristján Valur Jónsson
Cc: Jean-Paul Calderone; python-dev@python.org
Subject: Re: [Python-Dev] [Python-checkins] r68547 - in python/trunk/Lib/test: 
test_datetime.py test_os.py

On Thu, Jan 15, 2009 at 4:19 PM, Kristján Valur Jónsson
<krist...@ccpgames.com> wrote:
> Well, all the other functions raise OSError when the file descriptor is 
> invalid.  IOError usually means that the IO itself failed.
> I wonder if it is platform specific?  Does it raise IOError on all platforms?

It certainly looks like it:  here are lines 6632--6638 of
posixmodule.c, in posix_ftruncate:

        Py_BEGIN_ALLOW_THREADS
        res = ftruncate(fd, length);
        Py_END_ALLOW_THREADS
        if (res < 0) {
                PyErr_SetFromErrno(PyExc_IOError);
                return NULL;
        }

Mark

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to