On 27Feb2021 00:54, Irit Katriel <[email protected]> wrote:
>On Sat, Feb 27, 2021 at 12:47 AM Jim J. Jewett <[email protected]> wrote:
>> > 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:
>
>If obj.func() raises an ExceptionGroup that contains AttributeError then
>"except AttributeError" doesn't catch it. So it will get through.

And I, for one, would expect that. And _want_ that: I want the code to 
do what I said, not have some magic which silently/invisibly intercepts 
ExceptionGroups which contain something buried deep in their subgroup 
tree.

We already allow "deep" exceptions out, to be caught at an arbitrary 
outer call stack level. I don't see why ExceptionGroups should be any 
different.

I certainly do not want ExceptionGroup([AttributeError]) conflated with 
AttributeError. That fills me with horror.

Cheers,
Cameron Simpson <[email protected]>
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/CSJJSEEW2EY56JKMBCSD6R5SEJOF2ZVU/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to