[Python-Dev] win32 specific exception in the core?

Guido van Rossum guido@python.org
Wed, 16 Feb 2000 20:32:57 -0500


> Im looking for closure on the Win32 specific exception.  Summary for those
> that missed the thread:

My apologies.  I *did* miss the thread.  I think this is a reasonable
request.

> * I would like a standard exception for Win32 specific errors.  The new
> hopefully-to-be-standard "win32reg" module could make use of it, the win32
> extensions could switch to it.  It is, in my mind at least, analogous to
> OSError.
> 
> * I proposed deriving the new exception from EnvironmentError, like OSError
> is.
> 
> * Fredrik replied with "why not use OSError then?".  I answered "due to the
> numbering systems being different"
> 
> * Tim agreed that they should be different exceptions if they use different
> numbering, but pointed out it could still be OSError with creative exception
> hierarchies.
> 
> So, in summary, no one disagreed, and the only open issue was the exception
> hierarchy.  My initial proposal called for:
> 
> StandardError:
> -> EnvironmentError:
>    -> IOError
>    -> OSError
>    -> Win32Error
> 
>  Which would generally lead to people writing "except Win32Error:"
> 
> Tim's suggestion (as I understand it) was:
> StandardError:
> -> EnvironmentError:
>    -> IOError
>    -> OSError
>       -> CRTError (new - is what os.error would use)
>       -> Win32Error (new)

I see no merit in adding CRTError -- that's an abstraction that's only
relevant to C developers on Windows.

I do like it better if Win32Error derives from OSError.

Shouldn't it be just WinError or WindowsError?  I don't see why a
different exception should be used for Win64.

>  which would lead to people writing "except IOError:"

I don't understand this -- Win32Error isn't derived from IOError.

> I still like my idea better - fits better with the existing "IOError", and
> doesnt cause confusion with the change from os.error being OSError to
> os.error being CRTError.
> 
> Guido:  Can you first make a "yes/no" decision, then (if necessary <wink>)
> an either/or one?

OK, this is a definite Yes.

The either/or I'm still open on.

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