> Thank you for turning to what happens with 'except ValueError' when an
> ExceptionGroup[ValueError] is raised, this is important.

> I'm not sure it's safe to assume that it is necessarily a > programming
>error, and that the interpreter can essentially break the program in this
> case.

I'm betting it means a ValueError was raised, but then something (probably an 
asynchronous framework) aggregated it.  I won't swear you would never want to 
distinguish the two cases, or to distinguish them both from 
ExceptionGroup[ExceptionGroup[ExceptionGroup[ValueError]]], but ... normally 
you wouldn't.

> Is this not allowed?

>try:
>    try:
>        obj.func()    # function that raises ExceptionGroups
>    except AttributeError:
>        logger.info("obj doesn't have a func")
>except *(AttributeError, SyntaxError):
>    logger.info("func had some problems")

Allowed, but probably in error ... no AttributeError will get through to the 
except * unless it happened inside the except AttributeError handler.  Did you 
mean:

try:
    try:
        obj.func    # function that raises ExceptionGroups
    except AttributeError:
        logger.info("obj doesn't have a func")
    obj.func()
except *(AttributeError, SyntaxError):
    logger.info("func had some problems")

I see this as an argument that the except/except* split is tricky, but I don't 
think it says anything about whether except* clauses should be able to see into 
nested ExceptionGroups ... nor am I at all confident that I understood your 
intent. 

-jJ
_______________________________________________
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/XOAB7IJNXOHRL3HRVZ5VZON6MVHOPXB3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to