This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author iritkatriel
Recipients Jim.Jewett, Michael McCoy, Trundle, Václav Dvořák, Yury.Selivanov, alex, barry, benjamin.peterson, berker.peksag, charettes, cvrebert, daniel.urban, eric.araujo, eric.snow, fijal, gcbirzan, georg.brandl, gvanrossum, iritkatriel, jamesh, josh.r, jwilk, martin.panter, ncoghlan, pitrou, r.david.murray, serhiy.storchaka, yorik.sar
Date 2022-02-07.23:23:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
To summarise the discussion so far:

The arguments in favour of changing exception matching to match on virtual base classes are:

1. It is confusing that it doesn't follow issubclass semantics.
2. Two use cases were presented as practical motivation.
   - one in msg135521, which can be solved with the pattern in msg200418
   - one in msg200829, which is typically done with
         if condition:

The arguments against the change are
1. safety - calling python code from the exception propagation code
2. possible performance impact

I am not too worried about the performance of exception handling. I am also not impressed by the use cases.

For me it's mostly between the safety issue and the aesthetic language consistency issue. 

The code path from when a RAISE opcode executes and until control passes to an except clause, is a very sensitive one and I have a lot of sympathy to the position that we should just change the documentation to say that matching is on non-virtual base classes.  It is much easier to implement this feature than to predict how it would behave in all cases.

If we do decide to implement this, then I don't think the patch is the way we should do it. If the IsSubclass call fails, this should result in a "goto error", like when the match type is invalid:

This means that the failure to determine whether the exception is a match is the dominant error, rather than something we print to the ether via the unraisablehook and interpret as non-match.
Date User Action Args
2022-02-07 23:23:46iritkatrielsetrecipients: + iritkatriel, gvanrossum, barry, georg.brandl, jamesh, ncoghlan, pitrou, fijal, benjamin.peterson, jwilk, eric.araujo, alex, r.david.murray, Trundle, cvrebert, daniel.urban, yorik.sar, Yury.Selivanov, eric.snow, berker.peksag, martin.panter, Jim.Jewett, serhiy.storchaka, gcbirzan, charettes, josh.r, Václav Dvořák, Michael McCoy
2022-02-07 23:23:46iritkatrielsetmessageid: <>
2022-02-07 23:23:46iritkatriellinkissue12029 messages
2022-02-07 23:23:46iritkatrielcreate