![](https://secure.gravatar.com/avatar/268ecf5b8a9a200b1ec33a1a165ae828.jpg?s=120&d=mm&r=g)
On Sat, Feb 27, 2021 at 12:47 AM Jim J. Jewett <jimjjewett@gmail.com> 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.
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-leave@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/XOAB7IJN... Code of Conduct: http://python.org/psf/codeofconduct/