Thanks for the elaboration!

On Wed, Dec 26, 2012 at 6:42 PM, Antoine Pitrou <solip...@pitrou.net> wrote:
> On Wed, 26 Dec 2012 13:37:13 +0200
> Andrew Svetlov <andrew.svet...@gmail.com> wrote:
>> >
>> > As Serhiy's example shows, this mapping of error numbers to subclasses
>> > is implemented directly in OSError.__new__. We did this so that code
>> > could catch the new exceptions, even when dealing with old code that
>> > raises the legacy exception types.
>> >
>> Sorry.
>> Looks like OSError.__new__ requires at least two arguments for
>> executing subclass search mechanism:
>>
>> >>> OSError(errno.ENOENT)
>> OSError(2,)
>> >>> OSError(errno.ENOENT, 'error msg')
>> FileNotFoundError(2, 'error msg')
>
> Indeed, it does. I did this for consistency, because calling OSError
> with only one argument doesn't set the "errno" attribute at all:
>
>>>> e = OSError(5)
>>>> e.errno
>>>>
>
> Regards
>
> Antoine.
>
>
> _______________________________________________
> 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/andrew.svetlov%40gmail.com



-- 
Thanks,
Andrew Svetlov
_______________________________________________
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