On Wed, Feb 24, 2021 at 4:39 AM Guido van Rossum <gu...@python.org> wrote:

>
> OTOH we might reconsider deriving ExceptionGroup from BaseException --
> maybe it's better to inherit from Exception? I don't think the PEP
> currently has a clear reason why it must derive from BaseException. I
> believe it has to do with the possibility that ExceptionGroup might wrap a
> BaseException instance (e.g. KeyboardInterrupt or SystemExit).
>


That was the reason, and we also said that an ExceptionGroup escaping
something that isn't supposed to be raising ExceptionGroups is a bug, so if
you call an API that raises ExceptionGroups it is your responsibility to
handle them.

We could make ExceptionGroup be an Exception, and refuse to wrap anything
which is not an Exception. So asyncio either raises KeyboardInterrupt or an
ExceptionGroup of user exceptions.

Those are quite different directions.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/EO6Z3DRWFXCOMEYENLDVZSIN27T24BAI/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to