Undefined behaviour in C [was Re: The Cost of Dynamism]

Terry Reedy tjreedy at udel.edu
Sat Mar 26 16:44:41 EDT 2016


On 3/26/2016 1:43 PM, Rustom Mody wrote:

> There is this nice piece of OO called the exception hierarchy:

 > https://docs.python.org/2/library/exceptions.html#exception-hierarchy

https://docs.python.org/3/library/exceptions.html#exception-hierarchy

> BaseException ⊇ Exception ⊇ EnvironmentError ⊇ IOError

BaseException ⊇ Exception ⊇ ⊇ OSError

> At this point it would have been completely natural for IOError to continue
> subclassing to all the typical errors
> - File not found
> - No Space left on device

Which is why we now have

       +-- OSError
       |    +-- BlockingIOError
       |    +-- ChildProcessError
       |    +-- ConnectionError
       |    |    +-- BrokenPipeError
       |    |    +-- ConnectionAbortedError
       |    |    +-- ConnectionRefusedError
       |    |    +-- ConnectionResetError
       |    +-- FileExistsError
       |    +-- FileNotFoundError
       |    +-- InterruptedError
       |    +-- IsADirectoryError
       |    +-- NotADirectoryError
       |    +-- PermissionError
       |    +-- ProcessLookupError
       |    +-- TimeoutError

'no space' is MemoryError, but that is a hardward, not OS matter.

> But instead we have an integer errno and we must inquire what that is to
> figure out what the exact IOError was

This statement is obsolete, but explains why the above was added in 3.3.

-- 
Terry Jan Reedy





More information about the Python-list mailing list